:root {
  color-scheme: light;
  --bg: #f6f6f6;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --ink: #15191f;
  --muted: #6d7580;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --red: #d60000;
  --red-dark: #aa0000;
  --red-soft: #fff1f1;
  --green: #3faf54;
  --green-soft: #edf9ef;
  --amber: #c98200;
  --amber-soft: #fff6e7;
  --blue: #2d76a8;
  --blue-soft: #eef6fb;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 360px;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

h3 {
  margin-bottom: 0;
  font-size: 0.96rem;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  overflow: hidden;
  background:
    linear-gradient(90deg, #ffffff 0 220px, transparent 220px),
    var(--bg);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sidebar-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--green);
  font-size: 0.74rem;
  line-height: 1.35;
}

.sidebar-status svg {
  width: 15px;
  flex: 0 0 auto;
}

.sidebar-status.offline {
  color: var(--amber);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
}

.brand-lockup strong {
  display: block;
  font-size: 1rem;
  line-height: 1;
}

.brand-lockup strong span {
  color: var(--red);
}

.brand-lockup small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.mode-tabs {
  display: grid;
  gap: 8px;
}

.tab-button,
.tool-button,
.icon-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.tab-button {
  justify-content: flex-start;
  width: 100%;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  font-weight: 700;
}

.tab-button svg {
  color: var(--red);
}

.tab-button.active {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #ffd0d0;
}

.mailbox-button {
  position: relative;
}

.mailbox-button.has-alerts {
  color: var(--red-dark);
  background: var(--red-soft);
}

.mailbox-badge {
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  margin-left: auto;
  padding: 0 5px;
  color: #fff;
  background: var(--red);
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.app-main {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 14px 18px 18px;
  overflow: hidden;
}

.topbar,
.toolbar,
.workspace,
.map-heading,
.section-title,
.form-actions,
.tag-row,
.placement-box,
.list-item,
.detail-row,
.history-item {
  display: flex;
}

.topbar {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  margin-bottom: 14px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.topbar-meta span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar-meta strong {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--red);
  border-radius: 50%;
  font-size: 0.78rem;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--red);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.toolbar {
  align-items: stretch;
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  position: relative;
  flex: 1 1 150px;
  min-width: 0;
  min-height: 96px;
  padding: 14px 16px;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.metric.total {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.metric.ready {
  color: var(--green);
  background: var(--green-soft);
  border-color: #cbeed1;
}

.metric.warn {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #f1d7a7;
}

.metric.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #ffd0d0;
}

.metric.repair {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #cfe4f2;
}

.metric span {
  display: block;
  color: currentColor;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
}

.metric strong {
  display: block;
  margin-top: 7px;
  color: currentColor;
  font-size: 2rem;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 6px;
  color: rgba(21, 25, 31, 0.58);
  font-size: 0.72rem;
  font-weight: 700;
}

.metric.total small,
.metric.warn small,
.metric.ready small,
.metric.danger small,
.metric.repair small {
  color: rgba(21, 25, 31, 0.58);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 410px);
  align-items: stretch;
  gap: 14px;
  min-height: 0;
}

.map-panel,
.side-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.map-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.map-heading {
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.map-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  background: #f5f5f5;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.map-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: var(--green);
}

.legend-dot.due { background: var(--amber); }
.legend-dot.damaged { background: var(--red); }
.legend-dot.repairing { background: var(--blue); }

.tool-button,
.icon-button {
  width: 42px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.icon-button {
  width: 100%;
  justify-content: flex-start;
  padding: 0 12px;
}

.tool-button:hover,
.icon-button:hover,
.secondary-button:hover,
.photo-actions .file-button:hover {
  background: #f4f4f4;
}

#zoomSlider {
  width: 132px;
  accent-color: var(--red);
}

.map-scroller {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: #f1f1f1;
}

@media (min-width: 1041px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .app-main {
    height: auto;
    display: block;
    overflow: visible;
  }

  .workspace {
    align-items: start;
  }

  .map-panel {
    min-height: 0;
  }

  .map-scroller {
    flex: none;
    overflow: visible;
  }

  .map-scroller.zoomed {
    max-height: min(78vh, 860px);
    overflow: auto;
  }

  .side-panel {
    position: sticky;
    top: 14px;
    align-self: start;
    height: auto;
    max-height: calc(100vh - 28px);
    overflow: auto;
  }
}

.map-surface {
  position: relative;
  width: var(--map-width, 100%);
  min-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: grab;
}

.map-surface.placing {
  cursor: crosshair;
  outline: 3px solid rgba(214, 0, 0, 0.32);
}

.map-surface.panning {
  cursor: grabbing;
}

#mapImage {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.marker-layer {
  position: absolute;
  inset: 0;
}

.map-marker {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 38px;
  height: 38px;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--marker-color, var(--red));
  color: #fff;
  box-shadow: 0 9px 18px rgba(15, 23, 42, 0.22);
  display: grid;
  place-items: center;
  z-index: 2;
}

.map-marker.selected {
  outline: 5px solid rgba(214, 0, 0, 0.22);
  z-index: 4;
}

.map-marker.dragging {
  opacity: 0.72;
}

.map-marker svg {
  position: relative;
  z-index: 3;
  width: 20px;
  height: 20px;
  stroke-width: 2.6;
}

.marker-tooltip {
  position: absolute;
  left: 44px;
  top: 50%;
  display: none;
  min-width: max-content;
  max-width: 270px;
  padding: 8px 10px;
  color: #fff;
  background: rgba(21, 25, 31, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.24);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
  z-index: 3;
  pointer-events: none;
  text-align: left;
  transform: translateY(-50%);
  white-space: normal;
}

.map-marker:hover .marker-tooltip {
  display: block;
}

.map-marker.selected .marker-tooltip {
  left: 50%;
  top: calc(100% + 10px);
  display: block;
  transform: translateX(-50%);
}

.area-photo-frame {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: clamp(230px, 30vw, 380px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  border: 6px solid var(--red);
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.24);
  pointer-events: none;
  transform: translateY(-50%);
}

.map-marker.photo-right .area-photo-frame {
  left: 48px;
}

.map-marker.photo-left .area-photo-frame {
  right: 48px;
}

.area-photo-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.area-photo-empty {
  height: 100%;
  display: grid;
  place-content: center;
  gap: 5px;
  color: var(--red);
  text-align: center;
  background: rgba(255, 255, 255, 0.78);
}

.area-photo-empty svg {
  width: 30px;
  height: 30px;
  margin: 0 auto;
}

.area-photo-empty span {
  color: var(--muted);
  font-size: 0.78rem;
}

.map-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
  font-weight: 800;
}

.map-loader span {
  width: 32px;
  height: 32px;
  margin: 0 auto;
  border: 4px solid #ececec;
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.map-loader.hidden,
.hidden {
  display: none;
}

.side-panel {
  min-width: 0;
  min-height: 0;
  max-width: none;
  height: 100%;
  padding: 16px;
  overflow: auto;
}

.panel-head {
  margin: -16px -16px 14px;
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.detail-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.detail-card h3 {
  margin-bottom: 6px;
  font-size: 1.18rem;
}

.status-pill,
.condition-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.1;
  white-space: normal;
}

.status-pill,
.condition-pill {
  background: var(--green);
}

.status-pill.due {
  background: var(--amber);
}

.status-pill.issue,
.condition-pill.damaged {
  background: var(--red);
}

.condition-pill.repairing {
  background: var(--blue);
}

.detail-badges,
.list-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.detail-row {
  flex-direction: column;
  gap: 4px;
  min-height: 68px;
  padding: 10px;
  background: #f8f8f8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-row span,
.history-item span,
.list-item small {
  color: var(--muted);
  font-size: 0.78rem;
}

.detail-row strong,
.history-item strong {
  overflow-wrap: anywhere;
}

.history-item div strong,
.history-item div span {
  display: block;
}

.detail-empty {
  padding: 18px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
}

.front-status,
.front-note,
.check-box {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.front-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.check-box {
  padding: 12px;
  background: #fff8ed;
  border: 1px solid #f1d7a7;
  border-radius: 10px;
}

.list-section {
  margin-top: 14px;
}

.section-title {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.list-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 8px;
  margin-bottom: 10px;
}

.search-control {
  position: relative;
  display: block;
}

.search-control svg {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 17px;
  height: 17px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-control input {
  padding-left: 36px;
}

.list-empty {
  min-height: 140px;
  display: grid;
  place-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
}

.list-empty svg {
  width: 28px;
  height: 28px;
  margin: 0 auto;
}

.list-empty span {
  font-size: 0.78rem;
}

select,
input,
textarea {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 11px 12px;
}

select:focus,
input:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(214, 0, 0, 0.15);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
}

.ext-list,
.admin-list {
  display: grid;
  gap: 9px;
}

.list-item {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 88px;
  padding: 12px;
  text-align: left;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.list-item:hover,
.list-item.active {
  border-color: #ffd0d0;
  background: #fffafa;
}

.list-main {
  min-width: 0;
}

.list-main strong,
.list-main small {
  display: block;
  overflow-wrap: anywhere;
}

.admin-form {
  display: grid;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

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

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tag-row {
  gap: 8px;
}

.tag-row input {
  flex: 1;
}

.placement-box {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #f8f8f8;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.placement-box strong,
.placement-box span {
  display: block;
}

.placement-box span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.photo-field {
  display: grid;
  gap: 10px;
}

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

.photo-actions .file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  color: var(--ink);
  background: #f7f7f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.photo-actions .file-button input {
  display: none;
}

.photo-preview {
  min-height: 112px;
  display: grid;
  place-content: center;
  color: var(--muted);
  background: #f8f8f8;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 800;
  overflow: hidden;
}

.photo-preview.has-image {
  display: block;
  border-style: solid;
}

.photo-preview img {
  width: 100%;
  height: 150px;
  display: block;
  object-fit: cover;
}

.primary-button,
.secondary-button {
  padding: 0 14px;
  font-weight: 900;
}

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

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

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

.form-actions {
  align-items: center;
  gap: 8px;
}

.admin-card {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.admin-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.admin-card-actions {
  display: flex;
  gap: 5px;
}

.mini-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--ink);
  background: #f7f7f7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-button.delete {
  color: var(--red);
}

.history {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.history-item {
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  background: #f8f8f8;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  padding: 12px 14px;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1180px) {
  .toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1040px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    overflow: visible;
    background: var(--bg);
  }

  .app-sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
  }

  .mode-tabs {
    display: flex;
    margin-left: auto;
  }

  .sidebar-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .app-main {
    height: auto;
    display: block;
    overflow: visible;
  }

  .workspace {
    display: flex;
    flex-direction: column;
  }

  .side-panel {
    flex: none;
    max-width: none;
    height: auto;
    max-height: none;
  }

  .map-scroller {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .app-main {
    padding: 10px;
  }

  .app-sidebar,
  .topbar,
  .map-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .mode-tabs {
    margin-left: 0;
  }

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

  .topbar-meta {
    flex-wrap: wrap;
  }

  .mode-tabs,
  .tab-button,
  .map-tools {
    width: 100%;
  }

  .tab-button {
    justify-content: center;
    flex: 1;
  }

  #zoomSlider {
    flex: 1;
    width: auto;
  }

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

  .list-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .list-badges,
  .detail-badges {
    justify-content: flex-start;
  }

  .map-surface {
    min-width: 520px;
  }

  .map-legend {
    justify-content: flex-start;
  }

  .list-controls {
    grid-template-columns: 1fr;
  }
}

.modal-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(21, 25, 31, 0.46);
}

.modal-backdrop.hidden {
  display: none;
}

.admin-modal {
  position: relative;
  width: min(100%, 420px);
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.admin-modal > p:not(.eyebrow):not(.auth-error) {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.modal-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 8px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.modal-close:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.admin-modal form {
  display: grid;
  gap: 12px;
}

.admin-modal label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
}

.admin-modal input {
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.admin-modal .primary-button {
  width: 100%;
}

.mailbox-modal {
  position: relative;
  width: min(100%, 620px);
  max-height: min(82vh, 760px);
  display: flex;
  flex-direction: column;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.mailbox-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-right: 30px;
}

.mailbox-modal-head h2 {
  margin-bottom: 0;
}

.mailbox-modal .modal-close {
  top: 12px;
  right: 12px;
}

.mailbox-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  overflow: auto;
}

.mailbox-item {
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 6px;
}

.mailbox-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.mailbox-item-head strong,
.mailbox-item-head span,
.mailbox-item small {
  display: block;
}

.mailbox-item-head span,
.mailbox-item small,
.mailbox-item time {
  color: var(--muted);
  font-size: 0.78rem;
}

.mailbox-item p {
  margin: 10px 0 7px;
  white-space: pre-wrap;
  line-height: 1.45;
}

.mailbox-resolve {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.mailbox-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  padding: 6px 9px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.mailbox-progress.complete {
  color: var(--green);
  background: var(--green-soft);
  cursor: pointer;
}

.mailbox-progress input {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
}

.mailbox-resolve input {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
}

.mailbox-empty {
  min-height: 180px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.mailbox-empty svg {
  width: 30px;
  height: 30px;
  color: var(--green);
}

.mailbox-empty span {
  font-size: 0.82rem;
}

.auth-error {
  margin: 0;
  color: var(--red-dark);
  font-size: 0.82rem;
}

@media (max-width: 720px) {
  .sidebar-status {
    display: none;
  }

  .admin-modal {
    padding: 24px 20px;
  }
}
