/* ── TMS TOKENS ─────────────────────────────────────────── */
:root {
  --teal:       #00b0b7;
  --teal-hover: #1b9195;
  --teal-light: rgba(0,176,183,0.10);
  --teal-mid:   rgba(0,176,183,0.20);
  --dark:       #313131;
  --mid:        #444444;
  --light-bg:   #f0f0f0;
  --border:     #eeeeee;
  --white:      #ffffff;
  --btn-dark:   #32373c;

  --s-red:    #d93025;
  --s-blue:   #1a73e8;
  --s-orange: #e67e00;
  --s-green:  #2e7d32;
  --s-grey:   #9e9e9e;

  --font: 'DM Sans', sans-serif;
  --mono: 'DM Mono', monospace;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-hover: 0 2px 8px rgba(0,176,183,0.12), 0 8px 24px rgba(0,0,0,0.08);
}

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

body {
  font-family: var(--font);
  background: var(--light-bg);
  color: var(--dark);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── INSTALL BANNER ──────────────────────────────────────── */
#install-banner {
  display: none;
  background: var(--dark);
  color: var(--white);
  padding: 10px 20px;
  font-size: 13px;
  align-items: center;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  z-index: 100;
}
#install-banner.visible { display: flex; }
#install-banner strong { color: var(--teal); }
#install-banner .install-actions { display: flex; gap: 8px; align-items: center; }
.install-btn {
  font-family: var(--font);
  font-size: 12px; font-weight: 600;
  padding: 5px 14px;
  border-radius: 99px;
  border: none; cursor: pointer;
  background: var(--teal); color: var(--white);
  transition: background 0.15s;
}
.install-btn:hover { background: var(--teal-hover); }
.install-dismiss {
  background: none; border: none; color: #aaa;
  font-size: 18px; cursor: pointer; line-height: 1;
  padding: 2px 4px;
}
.install-dismiss:hover { color: var(--white); }
/* iOS instructions inside the banner */
#ios-hint { font-size: 12px; color: #ccc; display: flex; align-items: center; gap: 6px; }
#ios-hint svg { flex-shrink: 0; }

/* ── HEADER ─────────────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 2px solid var(--teal);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.header-left { display: flex; align-items: center; gap: 20px; }
.header-logo { height: 36px; object-fit: contain; }
.header-divider { width: 1px; height: 28px; background: var(--border); }
.header-title { font-size: 15px; font-weight: 600; color: var(--dark); letter-spacing: -0.01em; }
.header-sub   { font-size: 12px; color: var(--mid); font-weight: 400; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-badge {
  font-size: 11px; font-weight: 500; color: var(--teal);
  background: var(--teal-light); border: 1px solid var(--teal-mid);
  border-radius: 99px; padding: 3px 10px;
}

/* ── MAIN LAYOUT ────────────────────────────────────────── */
.main { max-width: 1600px; margin: 0 auto; padding: 24px 32px 48px; }

/* ── FILTER BAR ─────────────────────────────────────────── */
.filter-section { margin-bottom: 20px; }
.filter-label { font-size: 11px; font-weight: 500; color: var(--mid); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 8px; }
.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.fbtn {
  font-family: var(--font);
  font-size: 12px; font-weight: 400;
  padding: 5px 14px;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  background: var(--white);
  color: var(--mid);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.fbtn:hover { border-color: var(--teal); color: var(--teal); }
.fbtn.active {
  background: var(--teal); color: var(--white);
  border-color: var(--teal); font-weight: 500;
}

/* ── SECTION ────────────────────────────────────────────── */
.section { margin-bottom: 8px; }
.section-header {
  display: flex; align-items: center; gap: 10px;
  margin: 20px 0 10px;
}
.section-line { flex: 1; height: 1.5px; background: var(--teal); opacity: 0.3; }
.section-title {
  font-size: 11px; font-weight: 600; color: var(--teal);
  letter-spacing: 0.08em; text-transform: uppercase;
  white-space: nowrap;
}

/* ── GRID ───────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }

/* ── CARD ───────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--teal);
  opacity: 0;
  transition: opacity 0.18s;
}
.card:hover { border-color: var(--teal); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.card:hover::before { opacity: 1; }
.card.has-status { border-left: 3px solid var(--teal); }
.card.has-status.st1 { border-left-color: var(--s-blue); }
.card.has-status.st2 { border-left-color: var(--s-orange); }
.card.has-status.st3 { border-left-color: var(--s-green); }
.card.has-status.st4 { border-left-color: var(--s-grey); }

.card-meta { font-size: 10px; color: #aaa; font-family: var(--mono); margin-bottom: 3px; }
.card-magr { font-size: 13px; font-weight: 600; color: var(--dark); font-family: var(--mono); }
.card-kst  { font-size: 11px; font-weight: 500; color: var(--teal); font-family: var(--mono); background: var(--teal-light); border-radius: 4px; padding: 1px 6px; }
.card-name { font-size: 11px; color: var(--mid); line-height: 1.35; min-height: 30px; margin-bottom: 10px; }

.card-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 500;
  padding: 2px 8px; border-radius: 99px;
  margin-bottom: 8px;
}
.card-status.st0 { background: #f5f5f5; color: #aaa; }
.card-status.st1 { background: #e8f0fe; color: var(--s-blue); }
.card-status.st2 { background: #fff3e0; color: var(--s-orange); }
.card-status.st3 { background: #e8f5e9; color: var(--s-green); }
.card-status.st4 { background: #f5f5f5; color: var(--s-grey); }
.sdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.card-note {
  font-size: 10px; color: var(--mid);
  background: var(--light-bg); border-radius: 4px;
  padding: 4px 8px; margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 2px;
}
.card-info-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; margin-bottom: 10px;
}
.card-info-item { display: flex; flex-direction: column; gap: 2px; }
.card-info-label {
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: #bbb;
}
.card-info-val {
  font-size: 11px; color: var(--dark); font-weight: 500;
}
.card-info-val.mono { font-family: var(--mono); font-size: 11px; }

.card-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cbtn {
  font-family: var(--font);
  font-size: 11px; font-weight: 500;
  padding: 5px 8px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--mid);
  text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.cbtn svg { width: 11px; height: 11px; }
.cbtn.search:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-light); }
.cbtn.pdf { border-color: #fddbd8; color: #c0392b; }
.cbtn.pdf:hover { border-color: #c0392b; background: #fff5f4; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(49,49,49,0.4);
  z-index: 200; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  width: 420px; max-width: 95vw; max-height: 90vh;
  overflow-y: auto;
  border-top: 3px solid var(--teal);
}
.modal-header {
  padding: 20px 24px 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 4px;
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--dark); }
.modal-sub { font-size: 12px; color: #aaa; font-family: var(--mono); margin-top: 2px; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: #aaa; font-size: 20px; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
  transition: all 0.15s;
}
.modal-close:hover { color: var(--dark); background: var(--light-bg); }
.modal-body { padding: 0 24px 20px; }

.form-row { margin-top: 14px; }
.form-label {
  font-size: 11px; font-weight: 600; color: var(--mid);
  letter-spacing: 0.04em; text-transform: uppercase;
  display: block; margin-bottom: 6px;
}
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form-grid2 .col-label { font-size: 10px; color: #aaa; margin-bottom: 3px; }

select, input[type=date], input[type=number], textarea {
  font-family: var(--font);
  font-size: 13px; color: var(--dark);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  width: 100%;
  transition: border-color 0.15s;
  outline: none;
}
select:focus, input:focus, textarea:focus { border-color: var(--teal); }
textarea { resize: vertical; min-height: 56px; }

/* Date mode toggle */
.mode-toggle {
  display: inline-flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}
.mode-toggle button {
  font-family: var(--font);
  font-size: 11px; font-weight: 500;
  padding: 5px 12px;
  border: none; background: none;
  color: var(--mid); cursor: pointer;
  transition: all 0.12s;
}
.mode-toggle button + button { border-left: 1.5px solid var(--border); }
.mode-toggle button.active { background: var(--teal); color: var(--white); }

.dd-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--mid);
}
.dd-row input[type=number] { width: 70px; text-align: center; }
.dd-preview { font-size: 11px; color: var(--teal); font-family: var(--mono); font-weight: 500; }

/* URL previews */
.url-block { margin-top: 12px; }
.url-block-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; margin-bottom: 4px;
  display: flex; align-items: center; gap: 5px;
}
.url-block-label.search { color: var(--teal); }
.url-block-label.pdf { color: #c0392b; }
.url-text {
  font-family: var(--mono); font-size: 10px; color: #aaa;
  background: var(--light-bg); border-radius: 4px;
  padding: 6px 8px; word-break: break-all; line-height: 1.5;
}

/* Modal footer */
.modal-footer {
  padding: 14px 24px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-top: 1px solid var(--border);
}
.btn {
  font-family: var(--font);
  font-size: 13px; font-weight: 500;
  padding: 8px 18px; border-radius: 99px;
  border: none; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.15s;
}
.btn-ghost { background: var(--light-bg); color: var(--mid); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--mid); color: var(--dark); }
.btn-search { background: var(--teal-light); color: var(--teal); border: 1.5px solid var(--teal-mid); }
.btn-search:hover { background: var(--teal); color: var(--white); }
.btn-pdf { background: #fff5f4; color: #c0392b; border: 1.5px solid #fddbd8; }
.btn-pdf:hover { background: #c0392b; color: var(--white); }
.btn-save { background: var(--teal); color: var(--white); }
.btn-save:hover { background: var(--teal-hover); }

/* ── LEGEND ──────────────────────────────────────────────── */
.legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: fit-content;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mid); }
.ldot { width: 10px; height: 10px; border-radius: 50%; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media(max-width:700px){
  .main { padding: 16px; }
  .site-header { padding: 0 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 8px; }
}
