@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

:root,
[data-theme="light"] {
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;

  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface2: #f9f8f5;
  --surface-strong: #ffffff;
  --border: #e4e2db;
  --border2: #cccac3;

  --text: #1a1917;
  --text2: #6b6860;
  --text3: #9b9890;
  --muted: var(--text2);

  --accent: #1a1917;
  --accent-green: #2d5a3d;
  --primary: var(--accent);
  --primary-strong: #34312c;
  --success: #1d9e75;
  --warning: #ef9f27;
  --danger: #d45353;

  --blue-bg: #e6f1fb;
  --blue-txt: #0c447c;
  --blue-dot: #378add;
  --pink-bg: #fbeaf0;
  --pink-txt: #72243e;
  --pink-dot: #d4537e;
  --green-bg: #eaf3de;
  --green-txt: #27500a;
  --green-dot: #1d9e75;
  --amber-bg: #faeeda;
  --amber-txt: #633806;
  --amber-dot: #ef9f27;
  --red-bg: #fcebeb;
  --red-txt: #791f1f;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius: var(--radius-lg);

  --shadow: 0 10px 30px rgba(26, 25, 23, 0.06);
  --shadow-soft: 0 4px 14px rgba(26, 25, 23, 0.04);

  --nav-bg: var(--accent);
  --nav-link: rgba(255, 255, 255, 0.5);
  --nav-link-hover: rgba(255, 255, 255, 0.85);
  --footer-bg: var(--surface2);
  --upload-bg: var(--surface);
}

[data-theme="dark"] {
  --bg: #121417;
  --surface: #11161C;
  --surface2: #161C23;
  --surface-strong: #1d2127;
  --border: #273142;
  --border2: #3a4048;

  --text: #E6EAF0;
  --text2: #B8C0CC;
  --text3: #7A8394;
  --muted: var(--text2);

  --accent: #e8dfd2;
  --accent-green: #69b081;
  --primary: #f0e7da;
  --primary-strong: #ffffff;
  --success: #57c68d;
  --warning: #f0ae3c;
  --danger: #ea7e7e;

  --blue-bg: rgba(55, 138, 221, 0.18);
  --blue-txt: #99caf8;
  --blue-dot: #5ea7f0;
  --pink-bg: rgba(212, 83, 126, 0.18);
  --pink-txt: #f2a5c0;
  --pink-dot: #ef7da3;
  --green-bg: rgba(29, 158, 117, 0.18);
  --green-txt: #9ae2c8;
  --green-dot: #57c68d;
  --amber-bg: rgba(239, 159, 39, 0.18);
  --amber-txt: #f0c57a;
  --amber-dot: #f0ae3c;
  --red-bg: rgba(239, 68, 68, 0.16);
  --red-txt: #f1aaaa;

  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.22);

  --nav-bg: #0f1115;
  --nav-link: rgba(255, 255, 255, 0.6);
  --nav-link-hover: rgba(255, 255, 255, 0.92);
  --footer-bg: #111319;
  --upload-bg: var(--surface2);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: var(--font-sans);
  cursor: pointer;
}

input,
select,
textarea {
  font-family: var(--font-sans);
  color: var(--text);
}

.nav,
.app-navbar {
  background: var(--nav-bg);
  min-height: 52px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.app-navbar {
  backdrop-filter: blur(12px);
}

.app-navbar .navbar-brand,
.app-navbar .navbar-text,
.app-navbar .nav-link {
  color: var(--nav-link);
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .navbar-brand:hover {
  color: var(--nav-link-hover);
}

.app-navbar .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.12);
}

.app-navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.82)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.app-navbar .navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.1);
}

.nav-logo {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-right: 32px;
  white-space: nowrap;
  opacity: 0.95;
}

.nav-links {
  display: flex;
  flex: 1;
}

.nav-link {
  padding: 0 14px;
  height: 52px;
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--nav-link);
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--nav-link-hover);
}

.nav-link.active {
  color: #fff;
  border-bottom-color: #fff;
}

.nav-user {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-left: 16px;
  white-space: nowrap;
}

.app-theme-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.app-theme-toggle:hover,
.app-theme-toggle:focus {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px;
}

.page-sm {
  max-width: 820px;
}

.page-xs {
  max-width: 680px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.3px;
}

.card,
.app-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  color: var(--text);
}

.card {
  padding: 18px 20px;
}

.app-card {
  padding: 18px 20px;
}

.card + .card {
  margin-top: 12px;
}

.card-label,
.app-section-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text2);
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.grid4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

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

.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
}

.stat-card:hover {
  border-color: var(--border2);
}

.stat-card.active {
  border: 1.5px solid var(--accent);
}

.stat-card-label {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-card-val {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -1px;
  color: var(--text);
}

.badge,
.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge::before,
.app-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
  flex-shrink: 0;
}

.badge-received {
  background: var(--blue-bg);
  color: var(--blue-txt);
}

.badge-waiting {
  background: var(--pink-bg);
  color: var(--pink-txt);
}

.badge-delivered {
  background: var(--green-bg);
  color: var(--green-txt);
}

.badge-progress {
  background: var(--amber-bg);
  color: var(--amber-txt);
}

.badge-todo,
.badge.bg-secondary,
.app-badge.bg-secondary {
  background: var(--surface2) !important;
  color: var(--text2) !important;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-blue {
  background: var(--blue-dot);
}

.dot-pink {
  background: var(--pink-dot);
}

.dot-green {
  background: var(--green-dot);
}

.dot-amber {
  background: var(--amber-dot);
}

.dot-gray {
  background: var(--text3);
}

.btn,
.app-btn,
.app-btn-primary,
.app-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:active,
.app-btn:active,
.app-btn-primary:active,
.app-btn-outline:active {
  transform: scale(0.98);
}

.btn-primary,
.app-btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.btn-primary:hover,
.app-btn-primary:hover {
  opacity: 0.82;
  color: #fff;
}

.btn-outline,
.app-btn-outline,
.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger {
  background: var(--surface);
  color: var(--text2);
  border: 1px solid var(--border);
}

.btn-outline:hover,
.app-btn-outline:hover,
.btn-outline-secondary:hover,
.btn-outline-primary:hover,
.btn-outline-danger:hover {
  background: var(--surface2);
  color: var(--text);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red-txt);
  border: 0.5px solid rgba(212, 83, 83, 0.3);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--red-bg) 84%, white);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  justify-content: center;
  border: 0.5px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  border-radius: var(--radius-sm);
}

.btn-icon:hover {
  background: var(--surface2);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.form-label {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}

.form-label .optional {
  font-weight: 400;
  color: var(--text3);
}

.form-input,
.app-input,
.app-select,
.form-control,
.form-select {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 14px;
  background: var(--surface2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
  width: 100%;
}

.form-input:focus,
.app-input:focus,
.app-select:focus,
.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
  background: var(--surface2);
  color: var(--text);
}

.form-input-sm {
  height: 34px;
  font-size: 13px;
}

textarea.form-input,
textarea.app-input,
textarea.form-control {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
}

.form-control::placeholder,
.app-input::placeholder {
  color: var(--text3);
  opacity: 1;
}

input::placeholder,
select::placeholder,
textarea::placeholder,
.form-input::placeholder,
.form-select::placeholder {
  color: var(--text3);
  opacity: 1;
}

.form-hint {
  font-size: 12px;
  color: var(--text3);
  margin-top: 3px;
}

.divider {
  height: 0.5px;
  background: var(--border);
  margin: 16px 0;
}

.divider-or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text3);
  font-size: 12px;
  margin: 12px 0;
}

.divider-or::before,
.divider-or::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--border);
}

.chips,
.photo-type-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip,
.app-chip {
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12px;
  border: 0.5px solid var(--border2);
  cursor: pointer;
  background: var(--surface);
  color: var(--text2);
  transition: all 0.15s;
  user-select: none;
}

.chip:hover,
.app-chip:hover {
  background: var(--surface2);
  color: var(--text);
}

.chip.active,
.app-chip.active,
.photo-type-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.table-wrap {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  padding: 11px 16px;
  text-align: left;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface2);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover td {
  background: var(--surface2);
}

.td-id {
  font-size: 12px;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
}

.td-bold {
  font-weight: 500;
}

.td-muted {
  font-size: 12px;
  color: var(--text2);
}

.td-num {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.td-overdue {
  color: var(--red-txt);
  font-weight: 500;
}

.td-soon {
  color: var(--amber-txt);
  font-weight: 500;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.info-row:last-child {
  border-bottom: none;
}

.info-key {
  font-size: 12px;
  color: var(--text2);
}

.info-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.info-val-lg {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.total-row {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 8px;
  padding-top: 12px;
  border-top: 0.5px solid var(--border);
  margin-top: 6px;
}

.total-label {
  font-size: 12px;
  color: var(--text3);
}

.total-val {
  font-size: 15px;
  font-weight: 600;
}

.action-bar,
.app-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
}

.action-bar-summary {
  font-size: 13px;
  color: var(--text2);
}

.action-bar-summary strong {
  color: var(--text);
  font-weight: 500;
}

.photo-drop,
.app-upload {
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--upload-bg);
}

.photo-drop:hover,
.app-upload:hover {
  background: var(--surface2);
  border-style: solid;
}

.photo-drop-title {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 3px;
}

.photo-drop-hint {
  font-size: 11px;
  color: var(--text3);
}

.expand-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 0.5px dashed var(--border2);
  border-radius: var(--radius-sm);
  background: none;
  font-size: 13px;
  color: var(--text2);
  transition: all 0.15s;
  width: 100%;
  text-align: left;
}

.expand-btn:hover {
  background: var(--surface2);
}

.expand-btn.open {
  background: var(--surface2);
  border-style: solid;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text3);
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 20px;
  transition: color 0.15s;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.text-muted,
.app-muted {
  color: var(--text2) !important;
}

.text-hint {
  color: var(--text3);
}

.text-sm {
  font-size: 12px;
}

.text-xs {
  font-size: 11px;
}

.text-bold {
  font-weight: 500;
  color: var(--text);
}

.text-right {
  text-align: right;
}

.text-green {
  color: var(--accent-green);
}

.text-amber {
  color: var(--amber-txt);
}

.text-red {
  color: var(--red-txt);
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.w-full {
  width: 100%;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-12 {
  margin-bottom: 12px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-12 {
  margin-top: 12px;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
}

.app-footer {
  background: var(--footer-bg);
  border-top: 0.5px solid var(--border);
}

[data-theme="dark"] .btn-primary,
[data-theme="dark"] .app-btn-primary,
[data-theme="dark"] .chip.active,
[data-theme="dark"] .app-chip.active,
[data-theme="dark"] .photo-type-chip.active {
  color: var(--bg);
}

[data-theme="dark"] .card a:not(.btn):not(.chip),
[data-theme="dark"] .task-card,
[data-theme="dark"] .photo-drop,
[data-theme="dark"] .sms-history-row,
[data-theme="dark"] .total-val,
[data-theme="dark"] .total-label {
  color: var(--text);
}

.dropdown-menu {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.dropdown-item {
  color: var(--text);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--surface2);
  color: var(--text);
}

.modal-content,
.list-group-item,
.alert {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

@media (max-width: 991.98px) {
  .grid2,
  .grid3,
  .grid4 {
    grid-template-columns: 1fr;
  }

  .page-header,
  .action-bar,
  .app-action-bar {
    align-items: stretch;
  }
}
