/* ============================================================
   DOCUMENT MANAGEMENT SYSTEM — "Earth Green" theme
   Palette matches the visitor system: forest #1B4332, moss #40704A,
   sand #F1EBDD, clay #B5794A, ink #22301F
   ============================================================ */

:root{
  --forest: #1B4332;
  --forest-deep: #12291F;
  --moss: #40704A;
  --moss-light: #6B9071;
  --sand: #F1EBDD;
  --sand-light: #FAF7F0;
  --clay: #B5794A;
  --clay-dark: #96602F;
  --ink: #22301F;
  --line: #D9D0BC;
  --white: #FFFFFF;
  --danger: #B3452B;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(27, 67, 50, 0.12);
  --font-display: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'URW Palladio L', P052, serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*{ box-sizing: border-box; }

html,body{
  margin:0; padding:0;
  background: var(--sand);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body{
  min-height:100vh;
  background-image:
    radial-gradient(circle at 10% 0%, rgba(64,112,74,0.10), transparent 40%),
    radial-gradient(circle at 90% 100%, rgba(181,121,74,0.10), transparent 40%);
}

a{ color: var(--moss); }

h1,h2,h3{
  font-family: var(--font-display);
  color: var(--forest-deep);
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}

.wrap{
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.wrap.wide{ max-width: 1320px; }
.pt-0{ padding-top:0; }

/* ---------- Top bar / brand ---------- */
.brand{ display:flex; align-items:center; gap:12px; margin-bottom: 22px; }
.brand .logo{ height:42px; width:auto; flex-shrink:0; object-fit:contain; }
.topbar .brand .logo{ height:34px; background: var(--sand-light); padding:4px 8px; border-radius:8px; }
.brand .name{ font-family: var(--font-display); font-weight:600; font-size: 1.15rem; color: var(--forest-deep); }
.brand .tag{ font-size: 0.78rem; color: var(--moss); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- Card ---------- */
.card{
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.card + .card{ margin-top: 20px; }

.eyebrow{
  font-size: 0.72rem; font-weight:700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--clay-dark); margin-bottom: 6px; display:block;
}
.subtitle{ color:#5B6B54; font-size: 0.95rem; margin-bottom: 24px; }

/* ---------- Form ---------- */
label{ display:block; font-weight:600; font-size: 0.85rem; color: var(--forest-deep); margin: 16px 0 6px; }
label:first-of-type{ margin-top:0; }

input[type=text], input[type=tel], input[type=email], input[type=number],
input[type=password], input[type=date], input[type=time], input[type=search],
textarea, select{
  width:100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-family: var(--font-body); font-size: 1rem; background: var(--sand-light);
  color: var(--ink); transition: border-color .15s, background .15s;
}
textarea{ resize: vertical; }
input:focus, select:focus, textarea:focus{
  outline:none; border-color: var(--moss); background: var(--white);
  box-shadow: 0 0 0 3px rgba(64,112,74,0.15);
}
select{ appearance:none; -webkit-appearance:none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%2340704A' stroke-width='2' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position: right 16px center; padding-right: 40px;
}
.hint{ font-size:0.78rem; color:#7C8A73; margin-top:4px; }

.form-row{ display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
.form-row > div{ min-width:0; }
.form-row input{ width:100%; box-sizing:border-box; }
.form-row label{ margin-top:16px; }
@media (max-width: 560px){ .form-row{ grid-template-columns: 1fr; } }

code{
  background: var(--sand); border: 1px solid var(--line); border-radius: 4px;
  padding: 2px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em;
}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  width:100%; padding: 14px 20px; margin-top: 26px; border:none; border-radius: 10px;
  background: var(--forest); color: var(--sand-light); font-family: var(--font-body);
  font-weight:700; font-size: 1rem; cursor:pointer; transition: background .15s, transform .1s;
  text-decoration:none;
}
.btn:hover{ background: var(--forest-deep); }
.btn:active{ transform: scale(0.99); }
.btn.secondary{ background: transparent; color: var(--forest); border: 1.5px solid var(--forest); }
.btn.secondary:hover{ background: rgba(27,67,50,0.06); }
.btn.clay{ background: var(--clay); }
.btn.clay:hover{ background: var(--clay-dark); }
.btn.danger{ background: var(--danger); }
.btn.small{ width:auto; padding:9px 16px; margin-top:0; font-size:0.85rem; }

.error-box{
  background: #FBEAE3; border: 1px solid #E9B7A3; color: var(--danger);
  padding: 12px 14px; border-radius: 10px; font-size: 0.88rem; margin-bottom: 18px;
}
.success-box{
  background: #E8F0E4; border: 1px solid #B7CFAE; color: var(--forest-deep);
  padding: 12px 14px; border-radius: 10px; font-size: 0.88rem; margin-bottom: 18px;
}

/* ---------- Admin / dashboard topbar ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between; padding: 16px 28px;
  background: var(--forest); color: var(--sand-light); flex-wrap:wrap; gap:10px;
}
.topbar .brand{ margin-bottom:0; }
.topbar .brand .name, .topbar .brand .tag{ color: var(--sand-light); }
.topbar nav{ display:flex; align-items:center; flex-wrap:wrap; }
.topbar nav a{ color: var(--sand-light); text-decoration:none; font-size:0.88rem; font-weight:600; opacity:0.85; margin-left: 18px; }
.topbar nav a:hover{ opacity:1; text-decoration:underline; }
.topbar nav a.active{ opacity:1; text-decoration:underline; }

.nav-dropdown{ position:relative; margin-left: 18px; display:inline-flex; align-items:center; }
.nav-dropdown summary{
  cursor:pointer; list-style:none; user-select:none; display:flex; align-items:center;
  justify-content:center; height: 32px; width: 32px; border-radius: 8px; opacity:0.85;
  transition: opacity .15s, background .15s;
}
.nav-dropdown summary::-webkit-details-marker{ display:none; }
.nav-dropdown summary::marker{ content:''; }
.nav-dropdown summary:hover{ opacity:1; background: rgba(255,255,255,0.12); }
.nav-dropdown[open] summary{ opacity:1; background: rgba(255,255,255,0.18); }
.hamburger-lines{ display:flex; flex-direction:column; justify-content:center; gap:4px; width:20px; }
.hamburger-lines span{ display:block; height:2px; width:100%; background: var(--sand-light); border-radius:2px; }
.nav-dropdown-menu{
  position:absolute; top:100%; right:0; margin-top:10px; background: var(--white);
  border:1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  min-width:190px; padding:6px; z-index:30;
}
.nav-dropdown-menu a{
  display:block; color: var(--forest-deep) !important; opacity:1 !important; font-size:0.88rem;
  font-weight:600; margin-left:0 !important; padding:9px 12px; border-radius:8px; text-decoration:none !important;
}
.nav-dropdown-menu a:hover{ background: var(--sand-light); }

.stats-row{ display:grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap:16px; margin: 24px 0; }
.stat{ background:var(--white); border:1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat .num{ font-family: var(--font-display); font-size:2rem; color:var(--forest-deep); font-weight:600; }
.stat .lbl{ font-size:0.8rem; color:#7C8A73; text-transform:uppercase; letter-spacing:0.06em; }

/* ---------- Table ---------- */
table{ width:100%; border-collapse: collapse; margin-top: 10px; }
thead th{
  text-align:left; font-size:0.72rem; text-transform:uppercase; letter-spacing:0.06em;
  color:#7C8A73; padding: 10px 12px; border-bottom: 2px solid var(--line);
}
tbody td{ padding: 14px 12px; border-bottom: 1px solid var(--line); font-size:0.92rem; vertical-align: middle; }
tbody tr:hover{ background: rgba(64,112,74,0.04); }
.table-scroll{ overflow-x:auto; }

.badge{
  display:inline-block; padding:4px 10px; border-radius: 999px; font-size:0.74rem;
  font-weight:700; text-transform:uppercase; letter-spacing:0.03em;
}
.badge.role-admin{ background:#F3E9D2; color:var(--clay-dark); }
.badge.role-hod{ background:#DCE7F0; color:#2E5A78; }
.badge.role-staff{ background:#E8F0E4; color:var(--forest); }
.badge.active-yes{ background:#E8F0E4; color:var(--forest); }
.badge.active-no{ background:#E7E2D8; color:#7C8A73; }

.actions-cell{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.actions-cell form{ margin:0; }

.user-edit summary{
  list-style:none; cursor:pointer;
}
.user-edit summary::-webkit-details-marker{ display:none; }
.user-edit[open] summary{ background: var(--forest-deep); color:#fff; border-color: var(--forest-deep); }
.user-edit .edit-form{
  margin-top:10px; width:260px; background:#fff; border:1.5px solid var(--forest);
  border-radius:10px; padding:16px; box-shadow:0 4px 14px rgba(27,67,50,0.1);
  text-align:left;
}
.user-edit .edit-form label{ margin:10px 0 4px; }
.user-edit .edit-form label:first-of-type{ margin-top:0; }
.user-edit .edit-form input,
.user-edit .edit-form select{ width:100%; box-sizing:border-box; }
.user-edit .edit-form .btn{ width:100%; margin-top:14px; }

.text-center{ text-align:center; }
.text-muted{ color:#7C8A73; }
.pad-30{ padding:30px; }
.no-underline{ text-decoration:none; }
.justify-center{ justify-content:center; }

.checkbox-label{ display:flex; align-items:center; gap:8px; font-weight:600; font-size:0.88rem; color:var(--forest-deep); margin-top:16px; }
.checkbox-label input{ width:auto; }

/* ---------- Search bar ---------- */
.search-bar{
  display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; margin-bottom: 24px;
}
.search-bar .grow{ flex:1 1 260px; }
.search-bar label{ margin:0 0 6px; }
.search-bar .btn{ margin-top:0; width:auto; padding: 13px 22px; }
.search-bar select{ min-width: 180px; }

/* ---------- Document grid ---------- */
.doc-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap:16px; margin-top: 6px; }
.doc-card{
  background: var(--white); border:1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display:flex; flex-direction:column; gap:8px; transition: box-shadow .15s, transform .1s;
}
.doc-card:hover{ box-shadow: var(--shadow); transform: translateY(-2px); }
.doc-card a.doc-title{ font-weight:700; color:var(--forest-deep); text-decoration:none; font-size:1rem; line-height:1.3; }
.doc-card a.doc-title:hover{ text-decoration:underline; }
.doc-card .doc-meta{ font-size:0.78rem; color:#7C8A73; display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.doc-card .doc-desc{ font-size:0.85rem; color:var(--ink); flex-grow:1; }
.doc-card .doc-tags{ display:flex; flex-wrap:wrap; gap:6px; }
.tag-pill{ background: var(--sand); border:1px solid var(--line); color: var(--moss); font-size:0.7rem; padding:3px 9px; border-radius:999px; }

.filetype-badge{
  display:inline-flex; align-items:center; justify-content:center; font-size:0.65rem; font-weight:800;
  padding: 3px 7px; border-radius:6px; letter-spacing:0.02em; text-transform:uppercase; color:var(--white);
  background: var(--moss); flex-shrink:0;
}
.filetype-badge.pdf{ background:#B3452B; }
.filetype-badge.doc, .filetype-badge.docx{ background:#2B579A; }
.filetype-badge.xls, .filetype-badge.xlsx, .filetype-badge.csv{ background:#217346; }
.filetype-badge.ppt, .filetype-badge.pptx{ background:#B5794A; }
.filetype-badge.txt{ background:#7C8A73; }
.filetype-badge.jpg, .filetype-badge.jpeg, .filetype-badge.png{ background:#6B9071; }

/* ---------- Upload dropzone ---------- */
.dropzone{
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px 20px;
  text-align:center; background: var(--sand-light); transition: border-color .15s, background .15s; cursor:pointer;
}
.dropzone.drag-over{ border-color: var(--moss); background: var(--white); }
.dropzone .dz-icon{ font-size:2rem; margin-bottom:8px; }
.dropzone input[type=file]{ display:none; }
.dropzone .dz-filename{ margin-top:10px; font-weight:700; color:var(--forest-deep); word-break:break-all; }

/* ---------- Document detail ---------- */
.detail-meta{ background: var(--sand-light); border:1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-top: 18px; }
.detail-meta div{ display:flex; justify-content:space-between; gap:12px; padding:7px 0; font-size:0.9rem; border-bottom:1px dashed var(--line); }
.detail-meta div:last-child{ border-bottom:none; }
.detail-meta span:first-child{ color:#7C8A73; flex-shrink:0; }
.detail-meta span:last-child{ font-weight:600; color:var(--forest-deep); text-align:right; word-break:break-word; }

.btn-row{ display:flex; gap:10px; flex-wrap:wrap; margin-top:26px; }
.btn-row .btn{ margin-top:0; width:auto; flex:1 1 auto; }

footer.foot{ text-align:center; margin-top: 26px; font-size:0.82rem; }
footer.foot a{ color: var(--moss); text-decoration:none; }
footer.foot a:hover{ text-decoration:underline; }

.pagination{ display:flex; gap:6px; justify-content:center; margin-top: 24px; flex-wrap:wrap; }
.pagination a, .pagination span{
  display:inline-flex; align-items:center; justify-content:center; min-width:36px; height:36px;
  border-radius:8px; text-decoration:none; font-size:0.85rem; font-weight:600; color:var(--forest);
  border:1px solid var(--line); background:var(--white);
}
.pagination a:hover{ background: var(--sand-light); }
.pagination .current{ background: var(--forest); color: var(--sand-light); border-color: var(--forest); }

/* ---------- Folder breadcrumbs ---------- */
.breadcrumbs{ font-size:0.88rem; color:#7C8A73; margin-bottom:18px; display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.breadcrumbs a{ color:var(--forest); text-decoration:none; font-weight:600; }
.breadcrumbs a:hover{ text-decoration:underline; }
.folder-select-wrap{ position:relative; }

.login-wrap{ display:flex; align-items:center; min-height:100vh; }

/* ---------- QR code panel (document.php, QR Document section) ---------- */
.qr-box{ margin-top:20px; }
.qr-box summary{ list-style:none; cursor:pointer; width:auto; display:inline-flex; }
.qr-box summary::-webkit-details-marker{ display:none; }
.qr-box[open] summary{ background: var(--forest-deep); color:#fff; border-color: var(--forest-deep); }
.qr-panel{
  margin-top:14px; padding:20px; background:#fff; border:1.5px solid var(--forest);
  border-radius:10px; text-align:center; max-width:280px;
}
.qr-panel svg{ width:100%; height:auto; display:block; margin:0 auto; }
.qr-panel .qr-url{ font-size:0.78rem; color:#7C8A73; word-break:break-all; margin:12px 0; }
.qr-panel .btn{ margin-top:0; }
.qr-panel .hint{ text-align:left; }
.qr-box .qr-label-open{ display:none; }
.qr-box[open] .qr-label-closed{ display:none; }
.qr-box[open] .qr-label-open{ display:inline; }
