/* style.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #1D9E75;
  --green-dark: #0F6E56;
  --color-bg: #f5f4f0;
  --color-surface: #ffffff;
  --color-border: rgba(0,0,0,0.1);
  --color-border-md: rgba(0,0,0,0.18);
  --color-text: #1a1a18;
  --color-muted: #6b6b67;
  --color-hint: #9e9d99;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font: 'Inter', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1a1a18;
    --color-surface: #232320;
    --color-border: rgba(255,255,255,0.1);
    --color-border-md: rgba(255,255,255,0.18);
    --color-text: #f0ede8;
    --color-muted: #9e9d99;
    --color-hint: #6b6b67;
  }
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Login ─────────────────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--color-bg);
}

.login-box {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 40px; height: 40px;
  background: var(--green);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 20px;
}

.login-logo-text { font-size: 18px; font-weight: 500; }
.login-logo-sub  { font-size: 12px; color: var(--color-muted); }

.login-title { font-size: 15px; font-weight: 500; margin-bottom: 20px; }

.lang-bar {
  display: flex; gap: 8px; margin-bottom: 20px;
}

.flag-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 0.5px solid var(--color-border-md);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-muted);
  transition: all 0.15s;
}

.flag-btn:hover { border-color: var(--green); color: var(--color-text); }
.flag-btn.active { border-color: var(--green); color: var(--green); background: rgba(29,158,117,0.06); font-weight: 500; }
.flag-btn .flag { font-size: 18px; line-height: 1; }

.login-error {
  background: #FCEBEB; color: #A32D2D;
  border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13px; margin-bottom: 14px;
  display: none;
}

/* ── App Shell ─────────────────────────────────────────────────── */
#app-shell {
  display: none;
  height: 100vh;
  overflow: hidden;
}

.shell {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 0.5px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 16px 16px 14px;
  border-bottom: 0.5px solid var(--color-border);
}

.sidebar-logo-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 2px;
}

.sidebar-icon {
  width: 28px; height: 28px;
  background: var(--green);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px;
}

.sidebar-logo-name { font-size: 14px; font-weight: 500; }
.sidebar-logo-sub  { font-size: 11px; color: var(--color-muted); }

.sidebar-user {
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--color-border);
}

.sidebar-user-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--color-muted); }

.nav-section {
  font-size: 10px;
  color: var(--color-hint);
  padding: 12px 14px 4px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--color-muted);
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}

.nav-item:hover { background: var(--color-bg); color: var(--color-text); }
.nav-item.active { background: var(--color-bg); color: var(--color-text); font-weight: 500; border-left-color: var(--green); }
.nav-item i { font-size: 16px; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 0.5px solid var(--color-border);
  display: flex; flex-direction: column; gap: 10px;
}

.lang-bar-sidebar {
  display: flex; gap: 6px;
}

/* ── Main area ─────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 0.5px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

.topbar h1 { font-size: 15px; font-weight: 500; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}

/* ── Pages ─────────────────────────────────────────────────────── */
.page { display: none; }

/* ── Metrics grid ──────────────────────────────────────────────── */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.metric {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.metric-label { font-size: 11px; color: var(--color-muted); margin-bottom: 5px; }
.metric-value { font-size: 22px; font-weight: 500; }
.metric-sub   { font-size: 11px; color: var(--color-hint); margin-top: 2px; }

/* ── Section headings ──────────────────────────────────────────── */
.sh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.st { font-size: 11px; font-weight: 500; color: var(--color-hint); text-transform: uppercase; letter-spacing: .05em; }

/* ── Tables ────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
th {
  text-align: left; padding: 7px 10px;
  color: var(--color-hint); font-weight: 400; font-size: 11px;
  border-bottom: 0.5px solid var(--color-border);
}
td {
  padding: 9px 10px;
  border-bottom: 0.5px solid var(--color-border);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-bg); }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.ann-title { font-size: 13px; font-weight: 500; }
.ann-meta  { font-size: 11px; color: var(--color-hint); margin-top: 3px; }
.ann-body  { font-size: 13px; color: var(--color-muted); line-height: 1.6; margin-top: 8px; }

/* ── Project cards ─────────────────────────────────────────────── */
.proj-card {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.proj-head  { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.proj-title { font-size: 13px; font-weight: 500; }
.proj-desc  { font-size: 12px; color: var(--color-muted); margin-bottom: 10px; line-height: 1.5; }

.prog-bar   { height: 4px; background: var(--color-bg); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.prog-fill  { height: 100%; background: var(--green); border-radius: 2px; transition: width .3s; }
.prog-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--color-hint); margin-top: 4px; }

/* ── Directory ─────────────────────────────────────────────────── */
.dir-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--color-border);
}
.dir-row:last-child { border-bottom: none; }

.dir-info { flex: 1; min-width: 0; }
.dir-name { font-size: 13px; font-weight: 500; }
.dir-unit { font-size: 11px; color: var(--color-hint); }
.dir-contact { font-size: 12px; color: var(--color-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-badge { flex-shrink: 0; }

/* ── Avatar ────────────────────────────────────────────────────── */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #E6F1FB; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: #185FA5; flex-shrink: 0;
}

/* ── Badges & tags ─────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 7px; border-radius: 99px; font-size: 11px; font-weight: 500; }
.b-paid     { background: #EAF3DE; color: #3B6D11; }
.b-pending  { background: #FAEEDA; color: #854F0B; }
.b-overdue  { background: #FCEBEB; color: #A32D2D; }
.b-planning { background: #E6F1FB; color: #185FA5; }
.b-active   { background: #FAEEDA; color: #854F0B; }
.b-done     { background: #EAF3DE; color: #3B6D11; }
.b-paused   { background: #F1EFE8; color: #5F5E5A; }

.tag          { display: inline-block; padding: 2px 7px; border-radius: 99px; font-size: 11px; }
.tag-info     { background: #E6F1FB; color: #185FA5; }
.tag-warn     { background: #FAEEDA; color: #854F0B; }
.tag-success  { background: #EAF3DE; color: #3B6D11; }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; font-size: 12px;
  border: 0.5px solid var(--color-border-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font);
  transition: background 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--color-bg); }

.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }

.btn-sm { padding: 3px 8px; font-size: 11px; }

.btn-logout {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--color-muted);
  background: none; border: none; cursor: pointer;
  padding: 0; font-family: var(--font);
}
.btn-logout:hover { color: var(--color-text); }

/* ── Form elements ─────────────────────────────────────────────── */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; color: var(--color-muted); margin-bottom: 4px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="month"],
select, textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font);
  border: 0.5px solid var(--color-border-md);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); }
textarea { resize: vertical; height: 72px; }

/* ── Modals ────────────────────────────────────────────────────── */
.modal-bg {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-bg.open { display: flex; }

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  border: 0.5px solid var(--color-border);
}

.modal h2 { font-size: 15px; font-weight: 500; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }

/* ── Empty state ───────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-hint);
  font-size: 13px;
}
.empty i { font-size: 28px; margin-bottom: 10px; display: block; }

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-md); border-radius: 99px; }

/* ── Auth screen ──────────────────────────────────────────────────── */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--color-bg);
}

.auth-box {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 390px;
}

/* ── Auth tabs ────────────────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  border-bottom: 0.5px solid var(--color-border);
  margin-bottom: 22px;
  gap: 0;
}

.auth-tab {
  flex: 1;
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--color-muted);
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -0.5px;
}

.auth-tab:hover { color: var(--color-text); }
.auth-tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 500; }

/* ── Auth messages ────────────────────────────────────────────────── */
.auth-error {
  background: #FCEBEB;
  color: #A32D2D;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
  line-height: 1.5;
}

.auth-success {
  background: #EAF3DE;
  color: #3B6D11;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
  line-height: 1.5;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  padding: 9px 16px;
  font-size: 13px;
}

/* ── Field hint ───────────────────────────────────────────────────── */
.field-hint {
  font-size: 11px;
  color: var(--color-hint);
  margin-top: 5px;
  line-height: 1.5;
  padding: 6px 8px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

/* ── Profile page ─────────────────────────────────────────────────── */
.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.profile-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #E6F1FB;
  color: #185FA5;
  font-size: 18px;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.profile-name { font-size: 16px; font-weight: 500; }
.profile-role { font-size: 12px; color: var(--color-muted); margin-top: 2px; }

/* ── Nav sections ─────────────────────────────────────────────────── */
.nav-section {
  font-size: 10px;
  color: var(--color-hint);
  padding: 12px 14px 4px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ── Address / signup extras ──────────────────────────────────────── */
.field-section-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 16px 0 10px;
  padding-top: 12px;
  border-top: 0.5px solid var(--color-border);
}

.address-preview {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--color-bg);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
}

.address-preview i { color: var(--green); font-size: 16px; margin-top: 1px; }

.address-row-card {
  background: var(--color-bg);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
}

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

/* ── Sidebar credit ────────────────────────────────────────────────── */
.sidebar-credit {
  font-size: 10px;
  color: var(--color-hint);
  text-align: center;
  padding-top: 6px;
  border-top: 0.5px solid var(--color-border);
}
.sidebar-credit a {
  color: var(--color-hint);
  text-decoration: none;
}
.sidebar-credit a:hover { color: var(--green); text-decoration: underline; }

/* ── Help page ─────────────────────────────────────────────────────── */
.help-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.help-hero-icon {
  width: 48px; height: 48px;
  background: var(--green);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; flex-shrink: 0;
}
.help-hero-title { font-size: 18px; font-weight: 500; }
.help-hero-sub { font-size: 12px; color: var(--color-muted); }

.help-contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.faq-item {
  padding: 10px 0;
  border-bottom: 0.5px solid var(--color-border);
}
.faq-item:last-child { border-bottom: none; }
.faq-q { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.faq-a { font-size: 12px; color: var(--color-muted); line-height: 1.6; }
