* { box-sizing: border-box; }
body { font-family: Arial, sans-serif; background: #f3f4f6; margin: 0; color: #111827; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { background: #0f172a; color: #fff; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; }
.topbar .brand { font-weight: 700; font-size: 16px; }
.topbar .brand .sub { font-weight: 400; color: #94a3b8; font-size: 12px; margin-left: 8px; }
.topbar .who { font-size: 13px; color: #cbd5e1; }
.topbar .who a { color: #93c5fd; margin-left: 12px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 24px 0 10px; color: #1e3a8a; border-bottom: 2px solid #e5e7eb; padding-bottom: 6px; }
.sub { color: #6b7280; margin-bottom: 18px; }

.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
th { background: #f9fafb; font-weight: 600; color: #374151; }
tr:hover td { background: #f9fafb; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; }
.days { font-size: 12px; color: #6b7280; }
.days.late { color: #dc2626; font-weight: 700; }

.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; text-decoration: none; }
.btn-green { background: #16a34a; color: #fff; }
.btn-green:hover { background: #15803d; text-decoration: none; }
.btn-red { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.btn-gray { background: #e5e7eb; color: #111827; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.row { display: grid; grid-template-columns: 220px 1fr; gap: 8px 16px; margin-bottom: 8px; align-items: start; }
.row .lbl { font-weight: 600; color: #374151; font-size: 13px; }
label { font-size: 13px; font-weight: 600; color: #374151; display: block; margin-bottom: 4px; }
input[type=text], input[type=date], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-family: inherit; font-size: 14px; box-sizing: border-box;
}
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 14px; align-items: end; }
.filters .field { margin-bottom: 0; }
.filters-actions { display: flex; gap: 8px; }

.table-scroll { overflow-x: auto; }
.truncate { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.actions { white-space: nowrap; font-size: 13px; }

.compact-table { font-size: 13px; }
.compact-table th, .compact-table td { padding: 6px 8px; }
.compact-table .mode-line { color: #6b7280; font-size: 11px; }
.compact-table .badge { font-size: 11px; padding: 2px 8px; }
.compact-table .days { font-size: 11px; }

.btn-link-red { background: none; border: none; padding: 0; color: #dc2626; font-size: 13px; cursor: pointer; text-decoration: none; font-family: inherit; }
.btn-link-red:hover { text-decoration: underline; }

.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-item { padding: 10px 0; border-bottom: 1px solid #f3f4f6; }
.doc-item-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.doc-name { flex: 1; font-size: 14px; }
.doc-name .who { display: block; font-size: 11px; color: #9ca3af; text-transform: uppercase; }
.doc-status { font-size: 12px; }
.doc-status select { width: auto; padding: 4px 8px; font-size: 12px; }

.doc-attach { margin-top: 6px; }
.doc-attach-current { font-size: 12px; color: #16a34a; margin-bottom: 4px; }
.doc-attach-current a { color: #16a34a; font-weight: 600; }
.doc-attach-note { font-size: 12px; color: #6b7280; font-style: italic; margin-bottom: 4px; }
.doc-attach-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.doc-attach-form input[type=file] { font-size: 11px; max-width: 210px; }
.doc-attach-form input[type=text] { max-width: 220px; padding: 4px 6px; font-size: 12px; width: auto; }
.doc-attach-form button { padding: 4px 10px; font-size: 11px; }

.history { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.history li { padding: 6px 0; border-bottom: 1px dashed #e5e7eb; color: #4b5563; }
.history .arrow { color: #9ca3af; margin: 0 4px; }

.error { color: #dc2626; background: #fef2f2; border: 1px solid #fecaca; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.hint { font-size: 12px; color: #6b7280; margin-top: 4px; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f172a, #1e3a8a); }
.login-card { background: #fff; border-radius: 12px; padding: 36px 40px; width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,0.25); }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { margin-bottom: 20px; }
.login-demo { font-size: 12px; color: #6b7280; margin-top: 18px; border-top: 1px solid #e5e7eb; padding-top: 12px; line-height: 1.6; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-box { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 14px; text-align: center; }
.stat-box .n { font-size: 22px; font-weight: 700; color: #1e3a8a; }
.stat-box .l { font-size: 11px; color: #6b7280; margin-top: 2px; }

@media print {
    .topbar, .no-print { display: none !important; }
    body { background: #fff; }
}
