:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3fb;
  --ink: #121923;
  --muted: #617086;
  --line: #d9e2ef;
  --green: #174ea6;
  --green-dark: #0f3a80;
  --amber: #b88b00;
  --red: #df0f1a;
  --blue: #174ea6;
  --yellow: #ffdc17;
  --shadow: 0 16px 38px rgba(12, 41, 88, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: #0d2f68;
  color: #f6faf8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-logo {
  width: 48px;
  height: 54px;
  object-fit: contain;
  padding: 4px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgba(223, 15, 26, 0.18);
}

.brand strong,
.brand span,
.sync-panel strong,
.sync-panel span {
  display: block;
}

.brand span,
.sync-panel span {
  color: rgba(246, 250, 248, 0.66);
  font-size: 0.84rem;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  color: rgba(246, 250, 248, 0.78);
  background: transparent;
  text-align: left;
  border-radius: 8px;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: rgba(255, 220, 23, 0.13);
  box-shadow: inset 3px 0 0 var(--yellow);
}

.icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #0d2f68;
  background: #ffffff;
  font-weight: 800;
}

.sync-panel {
  margin-top: auto;
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.sync-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  background: var(--yellow);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 220, 23, 0.18);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
}

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.topbar-actions,
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.text-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  padding: 0 16px;
  color: #ffffff;
  background: var(--green);
  border-color: rgba(255, 220, 23, 0.28);
}

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

.ghost-button {
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.text-button {
  color: var(--green);
  background: transparent;
  padding: 0;
}

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

.button-icon {
  margin-right: 6px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel,
.detail-panel,
.table-shell,
.object-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(13, 47, 104, 0.04);
}

.metric-card {
  padding: 18px;
  border-top: 4px solid var(--blue);
}

.metric-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.time-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}

.utilization-grid {
  margin-top: 18px;
}

.admin-stack {
  display: grid;
  gap: 18px;
}

.admin-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.wide {
  min-width: 0;
}

.panel {
  padding: 18px;
}

.panel-heading,
.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.ticket-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.ticket-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
}

.ticket-card.selectable {
  text-align: left;
}

.ticket-card.selectable.active,
.ticket-card:hover {
  border-color: rgba(23, 78, 166, 0.42);
  box-shadow: 0 10px 24px rgba(23, 78, 166, 0.08);
}

.ticket-card p,
.object-card p,
.detail-panel p {
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.45;
}

.ticket-card > .primary-button {
  align-self: center;
  min-width: 164px;
}

.ticket-meta,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.pill.red {
  color: var(--red);
  background: #fff0f1;
}

.pill.amber {
  color: var(--amber);
  background: #fff7c7;
}

.pill.green {
  color: var(--green);
  background: #e7f0ff;
}

.pill.blue {
  color: var(--blue);
  background: #e7f1f8;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-field {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
}

select,
input,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  align-items: start;
}

.detail-panel {
  position: sticky;
  top: 24px;
  padding: 18px;
}

.detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.photo-empty,
.photo-upload {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.86rem;
}

.photo-empty {
  grid-column: 1 / -1;
  padding: 14px;
}

.photo-thumb {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.photo-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-thumb figcaption {
  padding: 7px 8px;
  color: var(--muted);
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-upload {
  display: grid;
  place-items: center;
  min-height: 42px;
  margin-top: 8px;
  cursor: pointer;
}

.photo-upload span {
  color: var(--blue);
  font-weight: 800;
}

.photo-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.team-list {
  display: grid;
  gap: 14px;
}

.team-row {
  display: grid;
  gap: 6px;
}

.team-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.bar {
  height: 8px;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 999px;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--red));
}

.weekly-load,
.daily-load,
.quick-time,
.time-summary {
  display: grid;
  gap: 12px;
}

.load-row,
.day-card,
.quick-time-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.load-head,
.day-card,
.quick-time-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.load-head span:not(.pill),
.day-card span,
.quick-time-card span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.quick-time-card button {
  min-width: 92px;
}

.load-bar {
  margin-top: 10px;
}

.load-bar span.blue,
.day-meter.blue {
  background: var(--blue);
}

.load-bar span.amber,
.day-meter.amber {
  background: var(--yellow);
  color: #443600;
}

.load-bar span.red,
.day-meter.red {
  background: var(--red);
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-top: 10px;
}

.week-strip span {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 54px;
  padding: 6px 4px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.week-strip i {
  position: absolute;
  inset: auto 0 0;
  display: block;
  background: rgba(23, 78, 166, 0.22);
}

.day-meter {
  display: grid;
  place-items: center;
  min-width: 58px;
  min-height: 38px;
  padding: 0 8px;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 900;
}

.table-shell {
  overflow: auto;
}

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

.admin-table {
  min-width: 780px;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

.object-card {
  padding: 18px;
}

.object-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: #e7f0ff;
  color: #0d2f68;
  border-radius: 8px;
  font-weight: 900;
}

.user-cell span,
.role-card span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.role-select {
  min-width: 180px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
}

.managed-list {
  display: grid;
  gap: 10px;
}

.managed-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.managed-card p {
  color: var(--muted);
  margin-bottom: 0;
}

.side-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.side-form h3 {
  margin-bottom: 2px;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.role-list {
  display: grid;
  gap: 10px;
}

.role-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.form-stack,
.form-grid {
  display: grid;
  gap: 12px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

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

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-line input {
  width: 18px;
  min-height: 18px;
}

.modal {
  width: min(760px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(16, 37, 31, 0.48);
}

.modal-card {
  padding: 20px;
}

@media (max-width: 1400px) {
  .admin-editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .brand div,
  .nav-item span:last-child,
  .sync-panel div {
    display: none;
  }

  .sidebar {
    align-items: center;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .metric-grid,
  .object-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work-grid,
  .time-layout,
  .admin-editor-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
    padding-bottom: 76px;
  }

  .sidebar {
    position: fixed;
    z-index: 5;
    inset: auto 0 0;
    height: 66px;
    display: block;
    padding: 8px;
  }

  .brand,
  .sync-panel {
    display: none;
  }

  .nav-list {
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
  }

  .nav-item {
    min-height: 50px;
    padding: 5px;
  }

  .icon {
    width: 30px;
    height: 30px;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button {
    flex: 1;
  }

  .metric-grid,
  .object-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .ticket-card {
    grid-template-columns: 1fr;
  }

  .managed-card {
    grid-template-columns: 1fr;
  }
}

.citizen-page {
  min-height: 100vh;
  background: var(--bg);
}

.citizen-shell {
  width: min(760px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 34px 0;
}

.citizen-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.citizen-hero img {
  width: 64px;
  height: 72px;
  object-fit: contain;
  padding: 5px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.citizen-hero h1 {
  margin: 0;
}

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

.form-message {
  min-height: 24px;
  color: var(--blue);
  font-weight: 800;
}
