/* PANCROP HUB — Design System */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #F1EFEC;
  --white: #FFF;
  --dark: #030303;
  --mid: #6B6560;
  --light: #D4C9BE;
  --border: #D4C9BE;
  --accent: #123458;
  --accent-lt: #E8EDF3;
  --accent-md: #1B4A7A;
  --warn: #9B2C2C;
  --warn-lt: #F8EAEA;
  --gold: #8B6914;
  --gold-lt: #F5F0E3;
  --green: #2D5A3D;
  --green-lt: #EAF0EC;
  --shadow: 0 1px 3px rgba(3,3,3,.04), 0 1px 2px rgba(3,3,3,.03);
  --shadow-md: 0 4px 16px rgba(3,3,3,.06);
  --font: 'DM Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body { background: var(--bg); font-family: var(--font); color: var(--dark); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }

/* ─── TOPNAV ─── */
.topnav { background: var(--white); border-bottom: 1px solid var(--border); padding: 0 28px; height: 56px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.nav-left { display: flex; align-items: center; gap: 28px; }
.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-links { display: flex; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; background: var(--accent); border-radius: 7px; display: flex; align-items: center; justify-content: center; color: white; font-size: 13px; font-weight: 700; }
.brand-text { font-size: 16px; font-weight: 700; color: var(--dark); }
.nav-link { font-size: 13px; font-weight: 500; color: var(--mid); padding: 6px 12px; border-radius: 6px; text-decoration: none; transition: all .15s; }
.nav-link:hover { background: var(--bg); color: var(--dark); }
.nav-link.active { background: var(--accent); color: white; font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 100px; padding: 5px 14px 5px 6px; font-size: 12px; color: var(--mid); cursor: pointer; }
.bell-wrap { position: relative; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--white); display: flex; align-items: center; justify-content: center; color: var(--mid); cursor: pointer; }
.bell-dot { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; background: var(--warn); border-radius: 50%; border: 1.5px solid var(--white); display: none; }
.bell-dot.show { display: block; }

/* ─── AVATAR ─── */
.avatar { width: 24px; height: 24px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 9px; font-weight: 700; flex-shrink: 0; }
.avatar-lg { width: 48px; height: 48px; border-radius: 12px; font-size: 16px; }
.avatar-sm { width: 32px; height: 32px; border-radius: 8px; font-size: 11px; }
.avatar-xl { width: 56px; height: 56px; border-radius: 14px; font-size: 18px; }

/* ─── PILLS ─── */
.pill { display: inline-flex; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 100px; white-space: nowrap; }
.pill-green { background: var(--green-lt); color: var(--green); }
.pill-gold { background: var(--gold-lt); color: var(--gold); }
.pill-red { background: var(--warn-lt); color: var(--warn); }
.pill-blue { background: var(--accent-lt); color: var(--accent); }
.pill-grey { background: var(--bg); color: var(--mid); border: 1px solid var(--border); }

/* ─── BUTTONS ─── */
.btn { font-family: var(--font); font-size: 13px; font-weight: 600; padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: all .15s; line-height: 1.3; }
.btn-p { background: var(--accent); color: white; }
.btn-p:hover { background: var(--accent-md); }
.btn-g { background: transparent; color: var(--mid); border: 1.5px solid var(--border); }
.btn-g:hover { background: var(--bg); }
.btn-w { background: var(--warn); color: white; }
.btn-w:hover { background: #7D2323; }
.btn-w:disabled, .btn-p:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { font-size: 11px; padding: 5px 12px; }
.btn-green { background: var(--green); color: white; }

/* ─── CARDS ─── */
.card { background: var(--white); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--border); }
.card-h { padding: 16px 20px; border-bottom: 1px solid rgba(212,201,190,.5); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-t { font-size: 13px; font-weight: 600; color: var(--dark); display: flex; align-items: center; gap: 8px; }
.card-t svg { width: 15px; height: 15px; stroke: var(--mid); stroke-width: 2; fill: none; }
.card-b { padding: 16px 20px; }

/* ─── STATS ─── */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); border: 1px solid var(--border); display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 20px; height: 20px; stroke: var(--mid); stroke-width: 2; fill: none; }
.stat-val { font-size: 22px; font-weight: 700; color: var(--dark); line-height: 1; margin-bottom: 2px; }
.stat-lbl { font-size: 12px; color: var(--mid); font-weight: 500; }

/* ─── FORMS ─── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--dark); display: flex; align-items: center; gap: 4px; }
.req { color: var(--warn); font-size: 11px; }
.field-hint { font-size: 11px; color: var(--mid); }
input, select, textarea {
  font-family: var(--font); font-size: 14px; color: var(--dark);
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px;
  padding: 10px 14px; width: 100%; outline: none; transition: border-color .2s;
  -webkit-appearance: none; appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: white; box-shadow: 0 0 0 3px rgba(18,52,88,.08); }
input::placeholder, textarea::placeholder { color: var(--light); }
input[readonly] { background: var(--accent-lt); border-color: #C0C8D4; color: var(--accent); cursor: not-allowed; }
textarea { resize: vertical; min-height: 70px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ─── SECTION LABELS ─── */
.sec-label { font-size: 11px; font-weight: 700; color: var(--mid); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; margin-top: 6px; }
.sec-title { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--mid); margin-bottom: 14px; margin-top: 28px; display: flex; align-items: center; gap: 10px; }
.sec-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ─── DATA TABLE ─── */
.dt { width: 100%; border-collapse: collapse; font-size: 13px; }
.dt th { text-align: left; font-size: 11px; font-weight: 600; color: var(--mid); text-transform: uppercase; letter-spacing: .5px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--border); }
.dt td { padding: 13px 16px; border-bottom: 1px solid var(--bg); vertical-align: middle; }
.dt tr:last-child td { border-bottom: none; }
.dt tr:hover td { background: #F8F7F5; }

/* ─── EMPLOYEE SEARCH ─── */
.es-wrap { position: relative; }
.es-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--white); border: 1.5px solid var(--accent); border-top: none; border-radius: 0 0 8px 8px; max-height: 220px; overflow-y: auto; z-index: 50; box-shadow: var(--shadow-md); display: none; }
.es-results.open { display: block; }
.es-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--bg); transition: background .1s; }
.es-item:hover { background: var(--bg); }
.es-item:last-child { border-bottom: none; }
.es-name { font-size: 13px; font-weight: 500; color: var(--dark); }
.es-meta { font-size: 11px; color: var(--mid); }

/* ─── SELECTED EMPLOYEE CARD ─── */
.sel-card { background: var(--accent-lt); border: 1.5px solid var(--accent); border-radius: 10px; padding: 16px; }
.sel-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sel-name { font-size: 16px; font-weight: 700; color: var(--accent); }
.sel-meta { font-size: 12px; color: var(--mid); margin-top: 2px; }
.sel-x { margin-left: auto; cursor: pointer; color: var(--mid); padding: 4px; }
.sel-x:hover { color: var(--warn); }
.sel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 16px; padding-top: 12px; border-top: 1px solid rgba(18,52,88,.1); }
.sel-item { font-size: 12px; color: var(--mid); }
.sel-item strong { color: var(--accent); display: block; font-size: 13px; font-weight: 600; }

/* ─── INFO / WARNING BOXES ─── */
.info-box { border-radius: 8px; padding: 10px 14px; font-size: 12px; display: none; align-items: flex-start; gap: 8px; }
.info-box.show { display: flex; }
.info-box svg { width: 15px; height: 15px; stroke-width: 2; fill: none; flex-shrink: 0; margin-top: 1px; }
.info-box.green { background: var(--green-lt); border: 1px solid #C0D4C8; color: var(--green); }
.info-box.green svg { stroke: var(--green); }
.info-box.warn { background: var(--warn-lt); border: 1px solid #E8D0D0; color: var(--warn); }
.info-box.warn svg { stroke: var(--warn); }
.info-box.gold { background: var(--gold-lt); border: 1px solid #E0D5BF; color: var(--gold); }
.info-box.gold svg { stroke: var(--gold); }
.info-box.blue { background: var(--accent-lt); border: 1px solid #C0C8D4; color: var(--accent); }
.info-box.blue svg { stroke: var(--accent); }

/* ─── FILE UPLOAD ─── */
.file-drop { border: 2px dashed var(--border); border-radius: 10px; padding: 20px; text-align: center; cursor: pointer; transition: all .15s; }
.file-drop:hover { border-color: var(--accent); background: var(--accent-lt); }
.file-drop svg { width: 24px; height: 24px; stroke: var(--mid); stroke-width: 1.5; fill: none; margin: 0 auto 6px; display: block; }
.file-drop-t { font-size: 13px; font-weight: 500; color: var(--dark); margin-bottom: 2px; }
.file-drop-s { font-size: 11px; color: var(--mid); }
.file-ok { background: var(--green-lt); border: 1.5px solid var(--green); border-radius: 10px; padding: 10px 14px; display: none; align-items: center; gap: 10px; }
.file-ok.show { display: flex; }
.file-ok svg { width: 16px; height: 16px; stroke: var(--green); stroke-width: 2; fill: none; flex-shrink: 0; }
.file-ok-name { font-size: 13px; font-weight: 500; color: var(--green); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-ok-x { font-size: 11px; color: var(--mid); cursor: pointer; }

/* ─── WORKFLOW PREVIEW ─── */
.wf { background: var(--bg); border-radius: 10px; padding: 14px 18px; border: 1px solid var(--border); }
.wf-label { font-size: 11px; font-weight: 600; color: var(--mid); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.wf-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wf-step { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--dark); }
.wf-dot { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.wf-dot.done { background: var(--accent); color: white; }
.wf-dot.wait { background: var(--light); color: var(--mid); }
.wf-arr { color: var(--light); font-size: 14px; }

/* ─── TOAST ─── */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: 10px; font-size: 13px; font-weight: 500; color: white; box-shadow: var(--shadow-md); animation: toastIn .3s; min-width: 250px; display: flex; align-items: center; gap: 8px; }
.toast.success { background: var(--accent); }
.toast.error { background: var(--warn); }
.toast svg { width: 16px; height: 16px; stroke: white; stroke-width: 2; fill: none; flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ─── LOADING ─── */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--mid); font-size: 13px; gap: 8px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── EMPTY STATE ─── */
.empty-state { padding: 40px 20px; text-align: center; color: var(--mid); }
.empty-state svg { width: 40px; height: 40px; stroke: var(--light); stroke-width: 1.5; fill: none; margin: 0 auto 12px; display: block; }
.es-text { font-size: 14px; font-weight: 500; color: var(--dark); margin-bottom: 4px; }
.es-sub { font-size: 12px; color: var(--mid); }

/* ─── PAGE LAYOUT ─── */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 28px 60px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-sub { font-size: 13px; color: var(--mid); }

/* Two-panel layout (table + form) */
.two-panel { display: grid; grid-template-columns: 1fr 440px; gap: 20px; align-items: start; }

/* Sidebar layout (documents, employees) */
.shell { display: flex; height: calc(100vh - 56px); }
.sidebar { width: 280px; background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sb-head { padding: 16px; border-bottom: 1px solid var(--border); }
.sb-title { font-size: 13px; font-weight: 600; color: var(--dark); margin-bottom: 10px; }
.sb-search { width: 100%; padding: 8px 10px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px; font-family: var(--font); font-size: 13px; color: var(--dark); outline: none; }
.sb-list { flex: 1; overflow-y: auto; }
.sb-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--bg); transition: background .1s; }
.sb-item:hover { background: var(--bg); }
.sb-item.sel { background: var(--accent-lt); }
.sb-name { font-size: 13px; font-weight: 500; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-proj { font-size: 11px; color: var(--mid); margin-top: 1px; }
.main-area { flex: 1; overflow-y: auto; padding: 24px; }

/* ─── LOGIN ─── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.login-card { background: var(--white); border-radius: 16px; box-shadow: var(--shadow-md); border: 1px solid var(--border); width: 100%; max-width: 400px; overflow: hidden; }
.login-header { background: var(--accent); padding: 32px; text-align: center; }
.login-header .brand-mark { width: 48px; height: 48px; font-size: 20px; margin: 0 auto 12px; background: rgba(255,255,255,.15); }
.login-header h1 { color: white; font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-header p { color: rgba(255,255,255,.5); font-size: 13px; }
.login-body { padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.login-error { background: var(--warn-lt); border: 1px solid #E8D0D0; border-radius: 8px; padding: 10px 14px; font-size: 12px; color: var(--warn); display: none; }
.login-error.show { display: block; }
.login-footer { text-align: center; padding: 0 32px 24px; font-size: 11px; color: var(--light); }

/* ─── RESPONSIVE ─── */
@media (max-width: 1000px) {
  .two-panel { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
}
@media (max-width: 600px) {
  .stat-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; max-height: 200px; }
  .topnav { padding: 0 16px; }
  .page { padding: 16px 16px 40px; }
}
