/* =========================================================================
   Flueron Inks Pvt Ltd — Sample Feedback Portal
   Design tokens — "wet ink on cool paper" palette
   ========================================================================= */
:root {
  /* Ink family — deep plum-indigo, like a fountain-pen bottle catching light */
  --ink-void:        #1A1530;
  --ink-plum:        #2E2350;
  --ink-indigo:      #4A3B7A;
  --ink-indigo-soft: #6857A8;

  /* Accent — warm copper (nib metal) + supporting hues, all pulled cooler
     than the plum so they read as accents, never blend into the navbar */
  --accent-copper:      #B9773D;
  --accent-copper-deep: #96602F;
  --accent-teal:         #1E7A63;
  --accent-amber:        #C08A1E;
  --accent-rose:          #B23A56;

  --canvas:          #F1EFF6;
  --surface:         #FFFFFF;
  --border:          #E1DEEC;
  --border-soft:     #EBE8F3;
  --text-primary:    #211C33;
  --text-secondary:  #5B5471;
  --text-muted:      #8D869E;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --topbar-h: 60px;
  --shadow-card: 0 1px 2px rgba(26,21,48,0.05), 0 8px 24px -12px rgba(26,21,48,0.16);

  --font-display: 'Fraunces', 'Georgia', 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; }

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

html, body {
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--ink-void); letter-spacing: -0.01em; margin: 0; font-optical-sizing: auto; }
h1 { font-size: clamp(21px, 3.2vw, 28px); font-weight: 600; line-height: 1.25; }
h2 { font-size: clamp(17px, 2.4vw, 21px); font-weight: 600; line-height: 1.3; }

/* ---- Top brand bar ---- */
.topbar {
  background: linear-gradient(120deg, var(--ink-void) 0%, var(--ink-plum) 55%, var(--ink-indigo) 100%);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 14px rgba(26,21,48,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid var(--accent-copper);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.logo-mark { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-mark svg { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(16px, 2.2vw, 19px);
  color: #ffffff;
  letter-spacing: 0.01em;
}
/* fleuron mark — a nod to the printer's ornament the company is named for */
.brand-name::after {
  content: ' ❦';
  color: var(--accent-copper);
  font-size: 0.85em;
}
.brand-sub {
  font-size: clamp(10px, 1.6vw, 11.5px);
  color: #C9BEEA;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 500;
}
.topbar-tag {
  font-size: 11px;
  color: #EBD9BE;
  background: rgba(185,119,61,0.16);
  border: 1px solid rgba(185,119,61,0.4);
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---- App shell (sidebar + content) ---- */
.app-shell { display: flex; align-items: flex-start; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  padding: 22px 14px;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.sidebar-section-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px;
  margin-bottom: 8px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.sidebar-link:hover { background: var(--border-soft); color: var(--ink-plum); }
.sidebar-link.active {
  background: rgba(74,59,122,0.1);
  color: var(--ink-indigo);
  font-weight: 600;
}
.sidebar-link.active .sidebar-icon { color: var(--accent-copper); }
.sidebar-icon { width: 16px; text-align: center; flex-shrink: 0; }
.main-content { flex: 1; min-width: 0; }

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    padding: 12px 14px;
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
}


/* ---- Page shell ---- */
.page-body { padding: clamp(14px, 3vw, 28px); }
.container { max-width: 1240px; margin: 0 auto; }
.container.narrow { max-width: 560px; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.page-meta { color: var(--text-secondary); font-size: 13px; margin: 6px 0 20px; }
.page-meta .dot { color: var(--text-muted); margin: 0 6px; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  padding: 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-soft);
}
.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-soft);
  padding: 20px 24px;
}

/* ---- Buttons ---- */
.actions { margin: 18px 0 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-copper);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-body);
  border: 1px solid var(--accent-copper);
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--accent-copper-deep); border-color: var(--accent-copper-deep); }
.btn:active { transform: translateY(1px); }
.btn-outline {
  background: transparent;
  color: var(--ink-plum);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--border-soft); border-color: var(--ink-indigo-soft); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

button.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--ink-indigo); font-weight: 600; font-size: 12.5px; font-family: var(--font-body);
}
button.link-btn:hover { text-decoration: underline; color: var(--accent-copper-deep); }

/* ---- Toolbar / search ---- */
.toolbar { display: flex; gap: 12px; align-items: center; margin: 18px 0; flex-wrap: wrap; }
.toolbar input[type="text"] { flex: 1 1 260px; min-width: 200px; max-width: 480px; }
#searchInvoice {
  /* grows with the toolbar/viewport instead of a small fixed size */
  width: clamp(220px, 28vw, 420px);
  max-width: 100%;
  padding: clamp(9px, 0.7vw, 13px) clamp(12px, 1vw, 16px);
  font-size: clamp(12.5px, 0.55vw + 0.45rem, 14.5px);
  margin-top: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}
#countLabel { font-size: 12.5px; color: var(--text-secondary); font-weight: 500; }
.refresh-note { font-size: 12px; color: var(--text-muted); }
#filterSite {
  width: auto;
  min-width: 150px;
  max-width: 220px;
  padding: clamp(9px, 0.7vw, 13px) clamp(12px, 1vw, 16px);
  font-size: clamp(12.5px, 0.55vw + 0.45rem, 14.5px);
  margin-top: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
}

/* ---- Table (data grid) ---- */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-soft);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  /* No forced min-width anymore — columns shrink/wrap to fit whatever
     screen width is available, so nothing gets pushed off-screen and a
     manual horizontal scroll is only ever needed on very small phones. */
  border-collapse: collapse;
  background: var(--surface);
  /* fluid base size: scales up smoothly on larger/high-res screens, never
     drops below a readable floor on small ones */
  font-size: clamp(11px, 0.5vw + 0.4rem, 13px);
  table-layout: auto;
}
thead tr:first-child th:first-child { border-top-left-radius: var(--radius-lg); }
thead tr:first-child th:last-child { border-top-right-radius: var(--radius-lg); }
tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-lg); }
tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-lg); }
th, td {
  padding: clamp(6px, 0.5vw, 11px) clamp(6px, 0.6vw, 11px);
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  font-size: clamp(10.5px, 0.45vw + 0.4rem, 12.5px);
  line-height: 1.5;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: break-word;
}
th {
  background: var(--ink-plum);
  color: #EFEAFA;
  font-size: clamp(9.5px, 0.3vw + 0.4rem, 11px);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: none;
  white-space: normal;
}
tbody tr { transition: background .1s ease; }
tbody tr:hover td { background: #F6F2FC; }
td small { color: var(--text-muted); font-size: clamp(11.5px, 0.4vw + 0.5rem, 13px); }
.mono { font-family: var(--font-mono); font-size: clamp(12px, 0.5vw + 0.5rem, 14px); color: var(--text-secondary); }

/* ---- Status badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-success { background: rgba(30,122,99,0.12); color: #145F4C; }
.badge-success .badge-dot { background: var(--accent-teal); }
.badge-pending { background: rgba(192,138,30,0.14); color: #8F6717; }
.badge-pending .badge-dot { background: var(--accent-amber); }
.badge-neutral { background: rgba(46,35,80,0.07); color: var(--text-secondary); }
.badge-neutral .badge-dot { background: var(--text-muted); }
.badge-info { background: rgba(74,59,122,0.12); color: var(--ink-indigo); }
.badge-info .badge-dot { background: var(--ink-indigo-soft); }
.badge-danger { background: rgba(178,58,86,0.1); color: #96304A; }
.badge-danger .badge-dot { background: var(--accent-rose); }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 8px; align-items: center; margin: 18px 0; font-size: 13px; }
.pagination button {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-plum);
}
.pagination button:hover:not([disabled]) { background: var(--border-soft); }
.pagination button[disabled] { opacity: 0.4; cursor: not-allowed; }
.pagination span { color: var(--text-secondary); font-size: 12.5px; }

/* ---- Forms ---- */
label { display: block; margin-top: 14px; font-weight: 600; font-size: 13.5px; color: var(--text-primary); }
select, textarea, input[type=text], input[type=email], input[type=date], input[type=number] {
  width: 100%;
  min-width: 160px;
  padding: clamp(8px, 0.6vw, 12px) clamp(10px, 0.8vw, 14px);
  margin-top: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: clamp(10.5px, 0.45vw + 0.4rem, 12.5px);
  background: var(--surface);
  color: var(--text-primary);
  box-sizing: border-box;
}
/* Inside the data table specifically, inputs need to shrink further than
   standalone forms so their column doesn't force the whole table wider
   than the screen. */
.table-wrap input[type=text],
.table-wrap input[type=email],
.table-wrap input[type=date],
.table-wrap select {
  min-width: 0;
  width: clamp(85px, 10vw, 170px);
}
select:focus, textarea:focus, input:focus {
  outline: none;
  border-color: var(--accent-copper);
  box-shadow: 0 0 0 3px rgba(185,119,61,0.16);
}
.phone-form input, .phone-form input[type=text] { width: 150px; }
.contact-form input { padding: 6px 9px; font-size: 12.5px; margin-top: 0; }

.rating { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.star { font-weight: 500; display: flex; align-items: center; gap: 5px; font-size: 13.5px; color: var(--text-secondary); }
.feedback-submit-form button.btn { margin-top: 22px; width: 100%; justify-content: center; padding: 12px; font-size: 14.5px; }

small { color: var(--text-muted); font-size: 11px; }

/* ---- Result / thank-you states ---- */
.result-icon { font-size: 40px; line-height: 1; margin-bottom: 6px; }
.footer-note { text-align: center; color: var(--text-muted); font-size: 11.5px; margin-top: 22px; }

/* ---- Summary strip (KPI cards) ---- */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 4px 0 18px;
}
.metric-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--ink-plum);
  min-width: 0;
}
.metric-card.accent-cyan { border-left-color: var(--ink-indigo-soft); }
.metric-card.accent-green { border-left-color: var(--accent-teal); }
.metric-card.accent-amber { border-left-color: var(--accent-amber); }
.metric-card.accent-navy { border-left-color: var(--ink-plum); }
.metric-card.accent-magenta { border-left-color: var(--accent-copper); }
.metric-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.5; flex-shrink: 0; }
.metric-card.accent-cyan .metric-dot { color: var(--ink-indigo-soft); }
.metric-card.accent-green .metric-dot { color: var(--accent-teal); }
.metric-card.accent-amber .metric-dot { color: var(--accent-amber); }
.metric-card.accent-navy .metric-dot { color: var(--ink-plum); }
.metric-card.accent-magenta .metric-dot { color: var(--accent-copper); }
.metric-value {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 25px);
  font-weight: 600;
  color: var(--ink-void);
  line-height: 1;
}
.metric-sub { font-size: 11px; color: var(--text-muted); margin-top: 5px; font-weight: 500; }
.metric-sub.positive { color: var(--accent-teal); font-weight: 600; }

/* ---- Invoice grouping (expand/collapse) ---- */
tr.group-row td { background: #F8F6FC; font-weight: 500; }
tr.group-row:hover td { background: #F0EAFA; }
.group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-plum);
  line-height: 1;
  padding: 0;
  vertical-align: middle;
}
.group-toggle:hover { background: var(--border-soft); border-color: var(--accent-copper); }
tr.sub-row td { background: #FCFBFE; }
tr.sub-row:hover td { background: #F6F2FC; }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(26,21,48,0.55); align-items: center; justify-content: center; z-index: 1000; }
.modal-card { background: var(--surface); padding: 24px 26px; border-radius: var(--radius-lg); min-width: 300px; max-width: 90vw; box-shadow: 0 20px 50px -12px rgba(26,21,48,0.45); }
.modal-card h3 { font-family: var(--font-display); margin-bottom: 4px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

@media (max-width: 900px) {
  .card, .panel { padding: 18px; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 52px; }
  html, body { font-size: 14px; }
  .page-body { padding: 14px; }
  .topbar { padding: 10px 14px; }
  .brand-sub { display: none; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { padding: 12px 13px; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn { justify-content: center; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input[type="text"], #searchInvoice, #filterSite { max-width: none; width: 100%; flex-basis: auto; }
}

@media (max-width: 400px) {
  .summary-strip { grid-template-columns: 1fr; }
}
