:root {
  --bg: #b7b9bc;
  --surface: #ffffff;
  --surface-2: #f5f7f6;
  --text: #1d252c;
  --muted: #7a838b;
  --line: #e5e9e7;
  --blue: #10745f;
  --blue-dark: #0b5f4d;
  --green: #10745f;
  --red: #b42318;
  --yellow: #9a6700;
  --ink: #121923;
  --shadow: 0 18px 42px rgba(30, 38, 45, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

input[type="checkbox"] {
  width: auto;
  min-height: auto;
  margin: 0 8px 0 0;
}

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 72px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.15;
}

.login-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(31, 111, 235, 0.22);
  border-color: var(--blue);
}

.primary-button,
.secondary-button,
.ghost-button,
.nav-item,
.icon-button,
.filter-button {
  border: 0;
  border-radius: 18px;
  min-height: 40px;
  padding: 9px 13px;
  font-weight: 750;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.secondary-button {
  background: #eef2f0;
  color: var(--green);
  border: 1px solid var(--line);
}

.filter-button {
  background: var(--green);
  color: #fff;
}

.ghost-button {
  background: var(--surface-2);
  color: var(--ink);
}

.form-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.topbar {
  width: min(1120px, calc(100vw - 48px));
  min-height: 64px;
  margin: 28px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

.topbar h1 {
  font-size: 24px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
}

.workspace {
  width: min(1120px, calc(100vw - 48px));
  margin: 0 auto 28px;
  display: grid;
  grid-template-columns: 150px 1fr;
  min-height: calc(100vh - 120px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}

.sidebar {
  padding: 16px 10px;
  border-right: 1px solid var(--line);
  background: #fbfcfa;
}

.nav-item {
  width: 100%;
  margin-bottom: 7px;
  background: transparent;
  color: #66717a;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: var(--ink);
  color: #fff;
}

.brand-mini {
  width: 68px;
  height: 30px;
  display: grid;
  place-items: center;
  margin: 0 0 18px;
  border-radius: 18px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.content {
  min-width: 0;
  padding: 18px;
  background: #fbfcfb;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto auto;
  gap: 10px;
  margin-bottom: 14px;
}

.source-notice {
  margin-bottom: 10px;
  padding: 10px 14px;
  border: 1px solid #cfe7dd;
  border-radius: 10px;
  background: #eef8f4;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding-left: 11px;
}

.search-box input {
  border: 0;
  outline: 0;
}

.table-shell {
  overflow: auto;
  max-height: calc(100vh - 230px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbfcfa;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}

tr:hover td {
  background: #fbfcff;
}

.status-pill,
.priority-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-new {
  color: #174ea6;
  background: #dbeafe;
}

.status-work {
  color: #22543d;
  background: #dff3e8;
}

.status-wait {
  color: #7a4d00;
  background: #fff2cc;
}

.status-closed {
  color: #475467;
  background: #e5e7eb;
}

.priority-high {
  color: var(--red);
  background: #fee4e2;
}

.priority-medium {
  color: var(--yellow);
  background: #fff4d6;
}

.priority-low {
  color: var(--green);
  background: #dff3e8;
}

.overdue {
  color: var(--red);
  font-weight: 800;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  min-width: 40px;
  background: var(--surface-2);
  color: var(--ink);
}

.filter-panel {
  display: none;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.filter-panel.open {
  display: grid;
}

.empty-state,
.analytics {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.38);
  z-index: 20;
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.modal-body {
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.full {
  grid-column: 1 / -1;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 20px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-list div,
.comment,
.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fbfcfa;
}

.detail-list span,
.history-item span,
.comment span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.side-stack,
.comments,
.history {
  display: grid;
  gap: 10px;
}

.comment-form {
  display: grid;
  gap: 9px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.bar {
  height: 10px;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--green);
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    gap: 8px;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .toolbar,
  .detail-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar,
  .user-chip {
    align-items: flex-start;
    flex-direction: column;
  }

  .content {
    padding: 14px;
  }

  .form-grid,
  .detail-list {
    grid-template-columns: 1fr;
  }
}
