/* =====================================================================
   GQM Services — Application styles
   Approach: calm, confident, professional. Built for daily use by
   non-technical staff. Light theme, clear typography, careful spacing.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Brand palette — deep teal + warm off-white */
  --c-bg:        #f6f5f1;
  --c-surface:   #ffffff;
  --c-surface-2: #fbfaf6;
  --c-border:    #e4e1d8;
  --c-border-2:  #cfcbbf;

  --c-text:      #1a2328;
  --c-text-2:    #4a5560;
  --c-muted:     #7d8793;

  --c-primary:        #0f4c5c;
  --c-primary-hover:  #0c3f4c;
  --c-primary-soft:   #e6eef1;

  --c-accent:    #c87533; /* warm copper accent — used sparingly */
  --c-success:   #2e7d32;
  --c-success-soft: #e8f5e9;
  --c-danger:    #b71c1c;
  --c-danger-soft:  #fdecea;
  --c-warning:   #b26a00;
  --c-warning-soft: #fff4e1;

  /* Typography */
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, serif;

  /* Layout */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15,35,40,.04), 0 1px 1px rgba(15,35,40,.03);
  --shadow:    0 4px 12px rgba(15,35,40,.06), 0 1px 3px rgba(15,35,40,.04);
  --shadow-lg: 0 20px 40px -12px rgba(15,35,40,.15);

  --sidebar-w: 260px;
  --topbar-h:  64px;
}

/* ----- reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0 0 .5rem 0; line-height: 1.25; color: var(--c-text); font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 .75rem 0; }

/* ============================================================
   LAYOUT — sidebar + main
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #0c2027;
  color: #e6eef1;
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 1rem;
}
.brand-logo {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c-accent), #a05a22);
  color: #fff;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .05em;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.15), 0 4px 10px rgba(200,117,51,.25);
}
.brand strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: -0.01em;
}
.brand small {
  display: block;
  color: #8fa3ac;
  font-size: .72rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 .75rem;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  color: #b8c6cc;
  border-radius: 8px;
  font-size: .9rem;
  transition: all .15s;
  text-decoration: none;
}
.sidebar nav a:hover {
  background: rgba(255,255,255,.05);
  color: #fff;
  text-decoration: none;
}
.sidebar nav a.active {
  background: var(--c-primary);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--c-accent);
}
.nav-ic {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px;
  opacity: .75;
  font-size: 1rem;
}
.nav-divider {
  border-top: 1px solid rgba(255,255,255,.08);
  margin: .75rem 0;
}

/* ----- main column ----- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0; /* allow tables to scroll */
}

.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.lang-switch {
  font-size: .8rem;
  color: var(--c-muted);
}
.lang-switch a {
  color: var(--c-muted);
  padding: 2px 4px;
}
.lang-switch a.on {
  color: var(--c-primary);
  font-weight: 600;
}
.lang-switch span { opacity: .4; margin: 0 2px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .9rem;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary), #1a6577);
  color: #fff;
  display: grid; place-items: center;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .05em;
}
.role-chip {
  background: var(--c-primary-soft);
  color: var(--c-primary);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.content {
  padding: 1.75rem;
  max-width: 1400px;
  width: 100%;
}

/* ============================================================
   HEADINGS / PAGE HEAD
   ============================================================ */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 1.65rem;
  color: var(--c-text);
  margin: 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1rem;
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .15s;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:hover {
  background: var(--c-surface-2);
  text-decoration: none;
  border-color: #9f9a8b;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}
.btn-primary:hover {
  background: var(--c-primary-hover);
  border-color: var(--c-primary-hover);
  color: #fff;
}
.btn-danger {
  background: var(--c-surface);
  color: var(--c-danger);
  border-color: #e6b3b3;
}
.btn-danger:hover {
  background: var(--c-danger);
  color: #fff;
  border-color: var(--c-danger);
}
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-block { width: 100%; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.card-head {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.card-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}
.card-body { padding: 1.25rem; }
.card-body.no-pad { padding: 0; }

/* two-column row on wide screens */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.row > .card { margin-bottom: 0; }
@media (max-width: 900px) {
  .row { grid-template-columns: 1fr; }
}

/* ============================================================
   STAT CARDS (dashboard)
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--c-primary);
}
.stat-card:nth-child(2)::before { background: var(--c-accent); }
.stat-card:nth-child(3)::before { background: #4a7c59; }
.stat-card:nth-child(4)::before { background: #6b5b95; }

.stat-label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-muted);
  font-weight: 500;
  margin-bottom: .5rem;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--c-text);
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ============================================================
   FORMS
   ============================================================ */
label {
  display: block;
  margin-bottom: 1rem;
}
label > span {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--c-text-2);
  margin-bottom: .35rem;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="number"],
input[type="date"],
select, textarea {
  width: 100%;
  padding: .55rem .75rem;
  font-family: inherit;
  font-size: .9rem;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(15,76,92,.12);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--c-bg);
  color: var(--c-muted);
}
textarea { resize: vertical; min-height: 80px; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}
.form-grid-2 .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid-2 { grid-template-columns: 1fr; } }

.form-section {
  margin: 1.25rem 0 .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--c-border);
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 600;
  color: var(--c-text-2);
  letter-spacing: -0.01em;
}
.form-section:first-child { margin-top: 0; }

.form-actions {
  display: flex;
  gap: .5rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--c-border);
}

.search-form {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex: 1;
  max-width: 420px;
}
.search-form input { flex: 1; }

/* ============================================================
   TABLES
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.data-table th, .data-table td {
  padding: .7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.data-table th {
  background: var(--c-surface-2);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text-2);
}
.data-table tbody tr:hover { background: var(--c-surface-2); }
.data-table .right { text-align: right; }
.data-table .center { text-align: center; }
.data-table td .btn + .btn,
.data-table td .btn + form,
.data-table td form + .btn { margin-left: .25rem; }

/* ============================================================
   KEY/VALUE LIST (detail pages)
   ============================================================ */
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .4rem 1.5rem;
  margin: 0;
}
.kv dt {
  color: var(--c-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .5rem 0;
  border-bottom: 1px dotted var(--c-border);
}
.kv dd {
  margin: 0;
  padding: .5rem 0;
  border-bottom: 1px dotted var(--c-border);
  color: var(--c-text);
}
@media (max-width: 600px) {
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { padding-bottom: 0; border: 0; }
  .kv dd { padding-top: .1rem; margin-bottom: .5rem; }
}

/* ============================================================
   BADGES / ALERTS
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-radius: 20px;
}
.badge-active   { background: var(--c-success-soft); color: var(--c-success); }
.badge-inactive { background: #e9ecef; color: #6c757d; }
.badge-draft    { background: #e9ecef; color: #6c757d; }
.badge-pending  { background: var(--c-warning-soft); color: var(--c-warning); }
.badge-accepted { background: var(--c-success-soft); color: var(--c-success); }
.badge-refused  { background: var(--c-danger-soft);  color: var(--c-danger); }

.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: .88rem;
  border: 1px solid;
}
.alert-error   { background: var(--c-danger-soft);  color: var(--c-danger);  border-color: #f5c6c6; }
.alert-success { background: var(--c-success-soft); color: var(--c-success); border-color: #b8e0ba; }

/* ============================================================
   UTILITIES
   ============================================================ */
.inline { display: inline-block; }
.muted  { color: var(--c-muted); }
.center { text-align: center; }
.right  { text-align: right; }

/* ============================================================
   ACTIVITY LOG (dashboard)
   ============================================================ */
.activity {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: .85rem;
}
.activity li {
  display: flex;
  gap: .75rem;
  padding: .5rem 0;
  border-bottom: 1px dotted var(--c-border);
  align-items: baseline;
  flex-wrap: wrap;
}
.activity li:last-child { border-bottom: 0; }
.activity-date {
  color: var(--c-muted);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  min-width: 110px;
}
.activity-user { font-weight: 500; }
.activity-action {
  color: var(--c-primary);
  background: var(--c-primary-soft);
  padding: 1px 8px;
  border-radius: 4px;
  font-size: .78rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.quick-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(15,76,92,.08), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(200,117,51,.08), transparent 50%),
    var(--c-bg);
  padding: 2rem 1rem;
}
.login-wrap {
  width: 100%;
  max-width: 420px;
}
.login-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-lg);
}
.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}
.brand-logo-lg {
  width: 60px; height: 60px;
  display: grid; place-items: center;
  margin: 0 auto .75rem;
  background: linear-gradient(135deg, var(--c-accent), #a05a22);
  color: #fff;
  border-radius: 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: .05em;
  box-shadow: 0 8px 20px rgba(200,117,51,.25), inset 0 -2px 4px rgba(0,0,0,.15);
}
.login-brand h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
.login-brand p {
  color: var(--c-muted);
  font-size: .85rem;
  margin: .25rem 0 0;
  letter-spacing: .02em;
}
.login-foot {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--c-border);
}

/* ============================================================
   ERROR PAGE
   ============================================================ */
.error-card {
  max-width: 460px;
  margin: 4rem auto;
  text-align: center;
  padding: 2.5rem 2rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.error-code {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: .5rem;
}

/* ============================================================
   RESPONSIVE — collapse sidebar on narrow screens
   ============================================================ */
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 240px;
    transform: translateX(-100%);
    transition: transform .2s;
    z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .user-chip span:not(.avatar):not(.role-chip) { display: none; }
  .page-head { gap: .75rem; }
}

/* Print */
@media print {
  .sidebar, .topbar, .form-actions, .page-head > a, .page-head > div { display: none; }
  .layout { grid-template-columns: 1fr; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
}
