/* =====================================================================
   DHL Urtal — Portal Styles (v2)
   ===================================================================== */

:root {
    --dhl-red: #d40511;
    --dhl-yellow: #ffcc00;
    --accent: #f59e0b;
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: rgba(255,255,255,0.04);
    --bg-card-hover: rgba(255,255,255,0.08);
    --border: rgba(255,255,255,0.08);
    --border-active: rgba(255,255,255,0.18);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
    --sidebar-width: 280px;
    --topbar-height: 56px;
    --transition: 0.2s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 10% 10%, rgba(212,5,17,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 90% 80%, rgba(255,204,0,0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ---- Glassmorphism ---- */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
}

/* ---- Overlay / Auth ---- */
.overlay {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(10,12,18,0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    transition: opacity 0.3s ease;
}
.overlay:not(.active) { opacity: 0; pointer-events: none; }

.auth-box {
    width: 420px;
    padding: 40px 36px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    animation: authSlideIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes authSlideIn {
    from { transform: translateY(-24px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1);       opacity: 1; }
}

.auth-logo-wrap {
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    gap: 16px; margin-bottom: 24px;
}
.auth-logo { max-width: 100%; height: auto; max-height: 140px; object-fit: contain; }
.auth-brand { font-size: 36px; font-weight: 800; letter-spacing: -0.5px; }
.auth-brand-dhl { color: var(--dhl-red); }
.auth-brand-urtal { color: var(--text-primary); }

.auth-subtitle {
    text-align: center;
    font-family: 'Zhi Mang Xing', cursive;
    font-size: 28px;
    margin-bottom: 16px;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #4285f4 0%, #ea4335 25%, #fbbc05 50%, #34a853 75%, #0071c5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0px 1px 3px rgba(0,0,0,0.6));
}
.auth-box h2 { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 24px; }

.auth-switch { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-secondary); }
.auth-switch a { color: var(--dhl-red); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ---- Top Bar ---- */
.top-bar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-height);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    border-radius: 0;
    border-top: none; border-left: none; border-right: none;
    border-bottom: 1px solid var(--border);
}
.top-bar-left { display: flex; align-items: center; gap: 16px; }
.top-bar-right { display: flex; align-items: center; gap: 10px; }

.portal-brand { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.brand-dhl { color: var(--dhl-red); }
.brand-urtal { color: var(--text-primary); }

.breadcrumb { font-size: 13px; color: var(--text-muted); }
.breadcrumb::before { content: '/ '; opacity: 0.4; }

.user-chip {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px;
    background: var(--bg-card); border: 1px solid var(--border);
    font-size: 12px; color: var(--text-secondary);
}
.user-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(16,185,129,0.3);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(16,185,129,0.3); }
    50% { box-shadow: 0 0 0 5px rgba(16,185,129,0.08); }
}

.admin-chip {
    padding: 4px 10px; font-size: 11px; font-weight: 600;
    background: rgba(168,85,247,0.12); color: #c084fc;
    border: 1px solid rgba(168,85,247,0.25); border-radius: 6px;
    text-decoration: none; transition: var(--transition);
}
.admin-chip:hover { background: rgba(168,85,247,0.22); }

/* ---- App Container ---- */
.app-container { position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 1; }

/* ---- Portal Dashboard ---- */
.portal-view {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: calc(var(--topbar-height) + 40px) 40px 40px;
    overflow-y: auto;
}

.portal-hero { text-align: center; margin-bottom: 48px; }
.portal-title {
    font-size: 36px; font-weight: 800; letter-spacing: -1px;
    margin-bottom: 12px;
}
.portal-title .accent { color: var(--dhl-red); }
.portal-subtitle { font-size: 16px; color: var(--text-secondary); }

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 900px; width: 100%;
}

.module-card {
    display: flex; align-items: center; gap: 20px;
    padding: 28px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    position: relative; overflow: hidden;
}
.module-card::before {
    content: ''; position: absolute;
    inset: 0; border-radius: 16px;
    background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 100%);
    opacity: 0; transition: opacity 0.2s;
}
.module-card:hover { transform: translateY(-4px); border-color: var(--border-active); box-shadow: var(--shadow); }
.module-card:hover::before { opacity: 1; }
.module-card:active { transform: translateY(-1px); }

.module-icon {
    width: 56px; height: 56px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.module-info { flex: 1; }
.module-info h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.module-info p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.module-arrow {
    font-size: 20px; color: var(--text-muted);
    transition: transform 0.2s, color 0.2s;
}
.module-card:hover .module-arrow { transform: translateX(6px); color: var(--text-primary); }

/* ---- Module Layout (inside a module) ---- */
.module-views {
    flex: 1; overflow: hidden;
    padding-top: var(--topbar-height);
    display: flex; flex-direction: column;
}
.module-layout { display: flex; flex: 1; overflow: hidden; }

.sidebar {
    width: var(--sidebar-width); flex-shrink: 0;
    border-radius: 0; border-top: none; border-left: none; border-bottom: none;
    overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 8px;
}
.sidebar-section h3 {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 12px;
    margin-top: 4px;
}

.main-content { flex: 1; overflow-y: auto; padding: 0; }

/* ---- Module Panel ---- */
.module-panel { display: flex; flex-direction: column; height: 100%; }

.module-header {
    border-radius: 0; border-left: none; border-right: none; border-top: none;
    padding: 16px 24px; flex-shrink: 0;
}
.module-header h1 { font-size: 20px; font-weight: 700; }
.module-header p { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.work-area {
    flex: 1; display: flex; gap: 16px;
    padding: 20px 24px; overflow-y: auto;
}
.work-area.single-col { flex-direction: column; }

/* ---- Panels ---- */
.panel {
    padding: 0;
    border-radius: var(--radius);
    overflow: hidden;
    flex: 1;
}
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.panel-header h3 { font-size: 14px; font-weight: 600; }

/* ---- Form ---- */
.settings-section { padding: 12px 0; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: none; }
.settings-section h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 10px; }

.input-group { display: flex; flex-direction: column; gap: 4px; padding: 12px 18px; }
.input-group label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"],
input[type="month"], select, textarea {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--dhl-red);
    background: rgba(255,255,255,0.08);
}
/* Override WebKit Autofill Background */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #1a1d27 inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: #1e2230; color: var(--text-primary); }

textarea { resize: vertical; min-height: 100px; }
.large-textarea { min-height: 140px; }

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 0 4px;
}
.form-section-title {
    padding: 12px 18px 4px;
    font-size: 12px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

/* ---- Buttons ---- */
button { cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; transition: var(--transition); }

.primary-btn {
    background: var(--dhl-red);
    color: white; border: none;
    padding: 10px 20px; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; gap: 8px;
}
.primary-btn:hover { background: #b8040f; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(212,5,17,0.35); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.secondary-btn {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 8px 16px; border-radius: var(--radius-sm);
}
.secondary-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--border-active); }

.outline-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 8px 16px; border-radius: var(--radius-sm);
}
.outline-btn:hover { border-color: var(--border-active); color: var(--text-primary); background: var(--bg-card); }

.danger-btn {
    background: rgba(239,68,68,0.12);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.25);
    padding: 8px 16px; border-radius: var(--radius-sm);
}
.danger-btn:hover { background: rgba(239,68,68,0.22); }
.danger-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.large-btn { padding: 12px 28px; font-size: 14px; }
.full-width-btn { width: 100%; justify-content: center; margin: 8px 0 0; }

.actions {
    display: flex; gap: 10px; padding: 16px 18px;
    align-items: center;
}

/* ---- Tab Bar ---- */
.tab-bar {
    display: flex; gap: 4px;
    padding: 8px; border-radius: var(--radius);
    flex-shrink: 0;
}
.tab-btn {
    flex: 1; padding: 10px 16px; border-radius: 8px;
    background: transparent; border: none;
    color: var(--text-secondary); font-size: 13px;
    transition: var(--transition);
}
.tab-btn.active {
    background: var(--dhl-red); color: white;
    box-shadow: 0 2px 12px rgba(212,5,17,0.35);
}
.tab-btn:not(.active):hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ---- Tracking specific styles ---- */
.results-area { display: flex; flex-direction: column; gap: 16px; flex: 1.2; }

.input-panel .panel-header,
.list-panel .panel-header,
.detail-panel .panel-header { flex-shrink: 0; }

#tracking-input { 
    width: 100%; 
    padding: 15px; 
    min-height: 160px; 
    border: none; 
    border-bottom: 1px solid var(--border); 
    resize: vertical; 
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace; 
    font-size: 14px; 
    line-height: 1.6; 
    background: rgba(0,0,0,0.2);
    color: var(--text-primary);
}

.list-container { overflow-y: auto; max-height: 260px; }

.tracking-item {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex; align-items: center; gap: 12px;
    transition: background 0.15s;
}
.tracking-item:hover { background: var(--bg-card-hover); }
.tracking-item.active { background: rgba(212,5,17,0.08); border-left: 3px solid var(--dhl-red); }

.track-number { font-family: monospace; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.track-status-text { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.track-status-icon { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-ok { background: var(--success); }
.status-error { background: var(--error); }
.status-pending { background: var(--warning); }

.timeline-container { padding: 16px 18px; overflow-y: auto; max-height: 320px; }
.timeline-item { display: flex; gap: 12px; padding: 8px 0; }
.timeline-dot-col { display: flex; flex-direction: column; align-items: center; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dhl-red); margin-top: 4px; flex-shrink: 0; }
.timeline-line { flex: 1; width: 1px; background: var(--border); margin-top: 4px; }
.timeline-event { font-size: 13.5px; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.timeline-location { font-size: 11px; color: var(--dhl-yellow); margin-top: 3px; display: flex; align-items: center; gap: 4px; opacity: 0.9; }
.timeline-time { font-size: 11px; color: var(--text-muted); margin-top: 1px; font-family: 'JetBrains Mono', monospace; opacity: 0.8; }

.progress-container { padding: 12px 18px; border-top: 1px solid var(--border); }
.progress-info { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12px; color: var(--text-secondary); }
.progress-bar-bg { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--dhl-red), var(--dhl-yellow)); border-radius: 2px; transition: width 0.3s ease; width: 0%; }

.excel-upload-wrapper { display: flex; }

/* ---- PLT Document Items ---- */
.plt-doc-item {
    display: grid; grid-template-columns: 1fr auto auto auto auto;
    gap: 8px; align-items: center;
    padding: 10px 18px; border-bottom: 1px solid var(--border);
}
.plt-doc-item input[type="file"] { display: none; }
.plt-doc-filename { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Get-Image Results ---- */
.gi-result-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.gi-result-item:last-child { border-bottom: none; }
.gi-result-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.gi-waybill-num { font-family: monospace; font-weight: 600; }
.gi-status-ok { color: var(--success); }
.gi-status-err { color: var(--error); }
.gi-doc-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.gi-doc-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; background: rgba(59,130,246,0.12);
    border: 1px solid rgba(59,130,246,0.25);
    border-radius: 6px; font-size: 11px; cursor: pointer;
    transition: var(--transition);
}
.gi-doc-chip:hover { background: rgba(59,130,246,0.22); }

/* ---- Declare ---- */
.uploaded-files-list { padding: 8px 18px; }
.uploaded-file-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 8px; background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.2); border-radius: 6px;
    font-size: 11px; margin: 3px;
}
.file-list { padding: 4px 18px; min-height: 24px; }
.file-list-item { font-size: 12px; color: var(--text-secondary); padding: 2px 0; }

.dec-goods-item {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin: 0 18px 12px;
    overflow: hidden;
}
.dec-goods-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px; background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border);
    font-size: 12px; font-weight: 600;
}

/* ---- Token Status ---- */
.token-status {
    padding: 8px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
    margin-bottom: 10px; text-align: center;
}
.token-status.no-token { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.token-status.has-token { background: rgba(16,185,129,0.1); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }

/* ---- Result Box ---- */
.result-box {
    margin: 0 18px 16px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px; line-height: 1.6;
    white-space: pre-wrap; word-break: break-word;
}
.result-box.success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25); color: #34d399; }
.result-box.error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #f87171; }
.result-box.info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.25); color: #93c5fd; }

/* ---- Badge ---- */
.badge {
    padding: 2px 8px; font-size: 11px; font-weight: 700;
    background: rgba(212,5,17,0.15); color: var(--dhl-red);
    border: 1px solid rgba(212,5,17,0.25);
    border-radius: 20px;
}
.badge-warn {
    background: rgba(245,158,11,0.15); color: var(--warning);
    border-color: rgba(245,158,11,0.25);
}

.tracking-number-badge {
    font-family: monospace; font-size: 12px; padding: 3px 10px;
    background: rgba(255,255,255,0.06); border: 1px solid var(--border);
    border-radius: 20px; color: var(--text-secondary);
}

/* ---- Misc ---- */
.hidden { display: none !important; }
.empty-state { padding: 32px; text-align: center; color: var(--text-muted); font-size: 13px; }

.error-msg { color: var(--error); font-size: 13px; text-align: center; margin-top: 8px; min-height: 20px; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.module-card { animation: fadeInUp 0.4s ease both; }
.module-card:nth-child(2) { animation-delay: 0.05s; }
.module-card:nth-child(3) { animation-delay: 0.1s; }
.module-card:nth-child(4) { animation-delay: 0.15s; }

/* ---- Custom Overrides & Specific Panel Styles ---- */
.doc-grid {
    display: grid; 
    grid-template-columns: 300px 1fr 350px; 
    gap: 20px; 
    align-items: start;
    height: calc(100vh - 180px);
}
.doc-config-panel, .doc-action-panel {
    display: flex; flex-direction: column; 
    height: 100%;
}
.doc-input-panel {
    display: flex; flex-direction: column;
    height: 100%;
}
.doc-console-log {
    flex: 1; min-height: 120px; background: #1e1e1e; color: #4ade80; 
    padding: 12px; border-radius: 6px; font-family: 'Courier New', monospace; 
    font-size: 12px; overflow-y: auto; line-height: 1.6; border: 1px solid var(--border); 
    margin-top: 10px;
}

/* ---- Responsive ---- */
@media (max-width: 1400px) {
    /* 14/16 inch laptops with display scaling => logical width is narrower */
    .doc-grid { grid-template-columns: 250px 1fr 280px; gap: 16px; }
}

@media (max-width: 1024px) {
    /* Tablet Portrait & Small Desktop */
    .module-grid { grid-template-columns: 1fr 1fr; }
    .form-grid-3 { grid-template-columns: 1fr 1fr; }
    .sidebar { width: 240px; }
    
    /* Doc Grid -> Drop to 2 Columns */
    .doc-grid { 
        grid-template-columns: 300px 1fr; 
        height: auto; 
    }
    .doc-action-panel { grid-column: span 2; height: auto; }
    .doc-input-panel { height: 400px; }
}

@media (max-width: 768px) {
    /* Mobile Devices */
    .auth-box { width: 92%; padding: 32px 20px; }
    .module-grid { grid-template-columns: 1fr; gap: 12px; }
    .form-grid-3 { grid-template-columns: 1fr; }
    
    /* Top Bar Mobile Optimization */
    .top-bar { padding: 0 12px; }
    .mobile-menu-btn { display: flex !important; justify-content: center; align-items: center; padding: 6px 10px; }
    .admin-chip { display: none !important; }
    #breadcrumb { display: none; }
    .portal-brand { font-size: 18px; }
    .user-chip { font-size: 11px; padding: 4px 8px; }
    
    /* Layout reflow */
    .portal-view { padding: calc(var(--topbar-height) + 20px) 16px 20px; }
    .main-content { overflow-y: visible; }
    .module-layout { display: block; position: relative; overflow-y: auto; overflow-x: hidden; }
    .work-area { padding: 12px; overflow: visible; }
    .module-header { padding: 16px 12px; }
    .module-header h1 { font-size: 18px; }
    
    /* Mobile Drawer Sidebar */
    .sidebar {
        position: fixed; top: var(--topbar-height); left: -100%; bottom: 0;
        width: 260px; z-index: 50;
        background: var(--bg-secondary);
        border-right: 1px solid var(--border);
        transition: left 0.3s ease;
        padding: 20px;
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    }
    .sidebar.mobile-show { left: 0; }
    
    /* Doc Grid -> 1 Column Stacked */
    .doc-grid { 
        display: flex; flex-direction: column; gap: 16px; 
    }
    .doc-input-panel { height: 280px; }
    
    /* Prevent iOS Form element zoom */
    input[type="text"], input[type="password"], input[type="number"], select, textarea {
        font-size: 16px; /* Must be 16px or larger to prevent autozoom */
    }
    
    .tab-bar { overflow-x: auto; padding-bottom: 4px; }
    .tab-btn { white-space: nowrap; flex: none; }
    .actions { flex-direction: column; align-items: stretch; }
    .actions .btn, .actions button { width: 100%; margin-bottom: 8px; display: block; }
    
    /* PLT Document Item Mobile Layout Fix */
    .plt-doc-item {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        background: var(--bg-hover);
        padding: 16px;
        border-radius: 8px;
        border: none;
        margin-bottom: 12px;
    }
    .plt-doc-filename { white-space: normal; overflow: visible; font-size: 13px; line-height: 1.4; margin: 4px 0; }
    .plt-doc-item select, .plt-doc-item button { width: 100% !important; margin: 0; box-sizing: border-box; }
}
