@charset "utf-8";

:root{
    --color-bg-page:#eef1f5;
    --color-bg-panel:#ffffff;
    --color-bg-sidebar:#fbfbfc;
    --color-bg-hover:#f1f5f9;
    --color-border-soft:#eef0f3;
    --color-text-primary:#111827;
    --color-text-muted:#374151;
    --color-primary:#3b82f6;
    --color-primary-hover:#2563eb;
    --color-active-bg:#e8f7ef;
    --color-active-text:#065f46;
    --layout-page-pad:30px;
    --layout-max-width:1140px;
    --layout-sidebar-width:220px;
    --layout-main-pad:30px;
}


/* RESET */
*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
}

html, body{
    height:100%;
}

html{
    overflow-y:scroll;
}

.top-actions {
    border: none !important;
    background: none !important;
    padding: 0 !important;
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* PAGE BACKGROUND */
body{
    background:var(--color-bg-page);
    padding:var(--layout-page-pad);
    padding-top:calc(var(--layout-page-pad) + 100px);
 
    color:var(--color-text-primary);
    
}

body:not(.login-page){
    display:flex;
    justify-content:center;
    align-items:flex-start;
}

/* MAIN APP CONTAINER */
.admin-wrapper{
    margin-top:0;
    display:flex;
    align-items:stretch;
    width:min(var(--layout-max-width), calc(100vw - (var(--layout-page-pad) * 2)));
    margin:0;
    background:var(--color-bg-panel);
    border-radius:18px;
    box-shadow:0 12px 30px rgba(0,0,0,0.08);
    overflow:hidden;
    min-height:calc(100vh - (var(--layout-page-pad) * 2));
   
}

/* SIDEBAR */
.sidebar{
    min-height:100%;
    height:auto;
    width:var(--layout-sidebar-width);
    flex:0 0 var(--layout-sidebar-width);
    background:#f8fafc;
    border-right:1px solid #e5eaf2;
    padding:14px 12px 16px;
    display:flex;
    flex-direction:column;
    gap:6px;
}

.sidebar.sidebar-full-height{
    align-self:stretch;
    height:auto;
    min-height:100%;
}

.top-actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    margin-top:0;
    margin-bottom:20px;
    padding:10px;
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:10px;
}

.top-actions a,
.top-actions button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:6px 14px;
    border-radius:8px;
    font-size:14px;
    line-height:1.2;
    text-decoration:none;
    border:1px solid #d1d5db;
    background:#fff;
    color:#111827;
    cursor:pointer;
    transition:all .2s ease;
}

.top-actions a:hover,
.top-actions button:hover{
    border-color:#94a3b8;
    background:#f8fafc;
    color:#0f172a;
}

.top-actions a.active{
    border-color:#3b82f6;
    background:#e8f0ff;
    color:#1d4ed8;
    font-weight:600;
}

.top-actions .danger-action{
    border-color:#fca5a5;
    color:#b91c1c;
    background:#fff7f7;
    font-weight:600;
}
.top-actions .danger-action:hover{
    background:#fef2f2;
    border-color:#ef4444;
    color:#991b1b;
}

.sidebar-title{
    display:flex;
    align-items:center;
    padding:10px 12px;
    margin-bottom:4px;
    border-radius:10px;
    font-size:11px;
    font-weight:700;
    letter-spacing:.1em;
    text-transform:uppercase;
    color:#64748b;
    background:#eef3f9;
}

.menu-item{
    text-decoration:none;
    color:#1f2937;
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 14px;
    border-radius:12px;
    font-size:14px;
    font-weight:500;
    letter-spacing:0.01em;
    border:1px solid transparent;
    transition:background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.menu-group{
    border-radius:12px;
}

.menu-title{
    display:flex;
    align-items:center;
    width:100%;
    gap:12px;
    border:0;
    background:transparent;
    text-align:left;
    padding:12px 14px;
    font-size:14px;
    font-weight:500;
    color:#334155;
    border-radius:12px;
    cursor:pointer;
    transition:background-color .2s ease, color .2s ease;
}

.submenu{
    max-height:0;
    overflow:hidden;
    opacity:0;
    padding-left:44px;
    padding-right:8px;
    transition:max-height .28s ease, opacity .22s ease, padding-top .2s ease, padding-bottom .2s ease;
}

.menu-group.open .submenu{
    max-height:320px;
    opacity:1;
    padding-top:4px;
    padding-bottom:8px;
}

.submenu a{
    display:flex;
    align-items:center;
    min-height:38px;
    padding:9px 12px;
    border-radius:10px;
    font-size:13.5px;
    font-weight:500;
    color:#475569;
    text-decoration:none;
    border:1px solid transparent;
    transition:background-color .2s ease, color .2s ease, border-color .2s ease;
}

.menu-item:hover,
.menu-title:hover,
.submenu a:hover{
    background:#edf2f8;
    color:#0f172a;
}

.menu-item.active{
    background:#eaf2ff;
    color:#1d4ed8;
    border-color:#cddffd;
    font-weight:650;
    box-shadow:inset 3px 0 0 #2563eb;
}

.menu-group.open > .menu-title{
    background:#eef3f9;
    color:#0f172a;
}

.submenu a.active{
    background:#eaf2ff;
    color:#1d4ed8;
    font-weight:650;
    border-color:#cddffd;
    box-shadow:inset 3px 0 0 #2563eb;
}

.icon{
    width:20px;
    height:20px;
    margin-right:0;
    color:#64748b;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
}

.icon svg{
    width:16px;
    height:16px;
    flex-shrink:0;
}

.menu-title .icon svg{
    width:17px;
    height:17px;
}

.menu-item.active .icon,
.menu-group.open > .menu-title .icon{
    color:#2563eb;
}

.arrow{
    margin-left:auto;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:18px;
    height:18px;
    color:#94a3b8;
    opacity:.95;
    transition:transform .22s ease, color .22s ease;
}

.arrow svg{
    width:14px;
    height:14px;
}

.menu-group.open > .menu-title .arrow{
    transform:rotate(90deg);
    color:#2563eb;
}

/* MAIN CONTENT */
.main-content{
    flex:1;
    min-width:0;
    padding:var(--layout-main-pad);
    display:flex;
    flex-direction:column;
}

.module-heading{
    font-size:22px;
    font-weight:600;
    margin-top:0;
    margin-bottom:12px;
}

.page-content{
    display:flex;
    flex-direction:column;
}

/* TOPBAR */
.topbar{
    position:fixed;
    top:0;
    left:0;
    width:100%;

    height:100px;
    padding:0 20px;

    display:flex;
    align-items:center;
    justify-content:space-between;

    background:var(--color-bg-panel);
    border-bottom:1px solid var(--color-border-soft);

    z-index:1000;
}

/* CENTER TEXT */
.topbar-center{
    position:absolute;
    left:50%;
    top:50%;
    transform:translate(-50%, -50%);
    text-align:center;
    pointer-events:none;
}

.topbar-title{
    font-weight:600;
    font-size:18px;
}

.topbar-datetime{
    font-size:13px;
    opacity:0.8;
    margin-top:2px;
}

.topbar-left{
    display:flex;
    align-items:center;
}

.topbar-left h3{
    margin:0;
    font-size:17px;
    font-weight:600;
}

.topbar-right{
    display:flex;
    align-items:center;
    margin-left:auto;
}

.avatar{
    width:30px;
    height:30px;
    border-radius:50%;
    background:var(--color-primary);
    color:white;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:13px;
    font-weight:550;
}

.user-menu{
    position:relative;
}

.user-menu-trigger{
    display:flex;
    align-items:center;
    gap:8px;
    font-size:14px;
    font-weight:500;
    color:var(--color-text-muted);
    background:transparent;
    border:none;
    border-radius:10px;
    padding:6px 8px;
    cursor:pointer;
}

.user-menu-trigger:hover{
    background:var(--color-bg-hover);
}

.user-menu-caret{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:14px;
    height:14px;
    opacity:.75;
}

.user-menu-caret svg{
    width:12px;
    height:12px;
}

.user-menu-dropdown{
    position:absolute;
    top:calc(100% + 8px);
    right:0;
    min-width:170px;
    background:#fff;
    border:1px solid #e2e8f0;
    border-radius:12px;
    box-shadow:0 14px 26px rgba(15,23,42,0.12);
    padding:8px;
    display:none;
    z-index:100;
}

.user-menu.open .user-menu-dropdown{
    display:block;
}

.user-menu-item{
    display:block;
    width:100%;
    text-decoration:none;
    font-size:14px;
    font-weight:600;
    padding:10px 12px;
    border-radius:10px;
    border:0;
    background:transparent;
    color:#334155;
    text-align:left;
    cursor:pointer;
    transition:background-color .18s ease, color .18s ease;
}

.user-menu-item:hover{
    background:#f1f5f9;
    color:#0f172a;
}

.user-menu-item.logout{
    color:#b91c1c;
}

.user-menu-item.logout:hover{
    background:#fee2e2;
    color:#991b1b;
}

/* SHARED COMPONENTS */
.card{
    background:var(--color-bg-panel);
    padding:25px;
    border-radius:14px;
    border:1px solid var(--color-border-soft);
}

.dashboard-actions{
    display:flex;
    gap:30px;
    margin-top:30px;
}

.action-box{
    flex:1;
    background:var(--color-primary);
    color:white;
    padding:40px;
    text-align:center;
    border-radius:12px;
    font-size:18px;
    font-weight:550;
    text-decoration:none;
    transition:.25s;
}

.action-box:hover{
    background:var(--color-primary-hover);
}

.form-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:20px;
}

.full-width{
    grid-column:span 2;
}

label{
    font-size:13px;
    font-weight:550;
    margin-bottom:6px;
    display:block;
}

input, textarea{
    width:100%;
    padding:10px 12px;
    border-radius:8px;
    border:1px solid #d1d5db;
    font-size:14px;
}

textarea{
    min-height:100px;
}

input:focus, textarea:focus, select:focus{
    border-color:var(--color-primary);
    outline:none;
    box-shadow:0 0 0 2px rgba(59,130,246,0.15);
}

.btn-primary{
    background:#f3f4f6;
    color:#111827;
    border:1px solid #d1d5db;
    padding:6px 10px;
    font-size:12px;
    font-weight:550;
    border-radius:5px;
    cursor:pointer;
    transition:all .2s ease;
    text-decoration:none;          /*removes blue link underline */
    display:inline-flex;
    align-items:center;
    justify-content:center;
}

.btn-primary:hover{
    background:#f3f4f6;
    transform:translateY(-1px);
    box-shadow:0 4px 10px rgba(0,0,0,0.08);
}

.btn-primary:active{
    transform:translateY(0);
    box-shadow:none;
}

.table-wrapper{
    overflow-x:auto;
}

.styled-table{
    width:100%;
    border-collapse:collapse;
    font-size:14px;
}

.styled-table thead{
    background:#f8fafc;
}

.styled-table th{
    text-align:left;
    padding:12px;
    font-weight:550;
    border-bottom:1px solid #e5e7eb;
}

.styled-table td{
    padding:12px;
    border-bottom:1px solid #f1f1f1;
}

.styled-table tr:hover{
    background:#f9fafb;
}

.dashboard-cards{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
    gap:25px;
    margin-top:30px;
}

.dashboard-card{
    justify-content:center;
    text-align:center;
    background:#f9fafb;
    padding:18px 20px;
    border-radius:14px;
    text-decoration:none;
    color:var(--color-text-primary);
    display:flex;
    align-items:center;
    gap:15px;
    font-size:16px;
    font-weight:500;
    border:1px solid var(--color-border-soft);
    transition:all .25s ease;
}

.dashboard-card:hover{
    background:#f3f4f6;
    transform:translateY(-2px);
}

.dashboard-card.dashboard-card-large{
    grid-column:span 2;
    min-height:92px;
    font-size:18px;
    font-weight:600;
}

.dashboard-card span.icon{
    font-size:22px;
}

.footer{
    margin-top:auto;
    text-align:center;
    font-size:13px;
    color:#6b7280;
    padding-top:10px;
    padding-bottom:5px;
    
}

/* LOGIN PAGE */
.login-page{
    background:#f4f6f9;
    display:flex;
    justify-content:center;
    align-items:center;
    height:100vh;
}

.login-card{
    background:var(--color-bg-panel);
    padding:40px;
    width:560px;
    border-radius:12px;
    box-shadow:0 10px 25px rgba(0,0,0,0.08);
    text-align:center;
}

.login-card h2{
    margin-bottom:5px;
    color:var(--color-text-primary);
}

.login-sub{
    color:#6b7280;
    margin-bottom:25px;
}

.login-card input{
    width:100%;
    padding:12px;
    margin-bottom:15px;
    border:1px solid #e5e7eb;
    border-radius:6px;
    font-size:14px;
}

.login-card button{
    width:100%;
    padding:12px;
    background:var(--color-primary-hover);
    border:none;
    color:white;
    font-size:15px;
    border-radius:6px;
    cursor:pointer;
    transition:.2s;
}

.login-card button:hover{
    background:#1d4ed8;
}

.error{
    color:red;
    margin-top:10px;
}

/* TOAST POPUP */
.toast {
    position:fixed;
    top:20px;
    right:20px;
    min-width:280px;
    padding:15px 20px;
    border-radius:8px;
    font-size:14px;
    font-weight:500;
    color:#fff;
    opacity:0;
    transform:translateX(100%);
    transition:all 0.4s ease;
    z-index:9999;
}

.toast.success {
    background:#16a34a;
}

.toast.show {
    opacity:1;
    transform:translateX(0);
}

/* DASHBOARD REFINED UI */
.kpi-big-number {
    font-size:52px;
    font-weight:800;
    margin-top:6px;
    letter-spacing:1px;
}

.dashboard-number {
    font-size:22px;
    font-weight:700;
    margin-top:6px;
}

.main-content h3 {
    font-size:16px;
    font-weight:550;
    color:var(--color-text-muted);
}

.status-pill {
    display:inline-block;
    margin-top:8px;
    padding:5px 14px;
    border-radius:20px;
    font-size:12px;
    font-weight:550;
    transition:all 0.3s ease;
}

.status-live {
    background:#e6f9f0;
    color:#059669;
    animation:liveGlow 1.8s infinite;
}

.status-closed {
    background:#fde8e8;
    color:#dc2626;
}

@keyframes liveGlow {
    0% {
        box-shadow:0 0 0 0 rgba(5,150,105,0.5);
    }
    70% {
        box-shadow:0 0 8px 5px rgba(5,150,105,0);
    }
    100% {
        box-shadow:0 0 0 0 rgba(5,150,105,0);
    }
}

select{
    width:100%;
    padding:10px 12px;
    border-radius:8px;
    border:1px solid #d1d5db;
    font-size:14px;
    background:#fff;
}

.alert{
    border-radius:8px;
    padding:10px 12px;
    margin-bottom:14px;
    font-size:14px;
}

.alert-success{
    background:#e7f8ee;
    color:#065f46;
    border:1px solid #a7f3d0;
}

.alert-error{
    background:#fef2f2;
    color:#991b1b;
    border:1px solid #fecaca;
}

.dashboard-card .card-icon{
    width:38px;
    height:38px;
    border-radius:10px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    background:#e8f0ff;
    color:#1d4ed8;
    border:1px solid #c7d8ff;
    flex-shrink:0;
}

.dashboard-card .card-icon svg{
    width:20px;
    height:20px;
}

@media (max-width:900px){
    .dashboard-card.dashboard-card-large{
        grid-column:span 1;
    }
}
/* HISTORY TABLE */
.history-table-wrap{
    width:100%;
    overflow-x:auto;
    overflow-y:hidden;
    padding-bottom:8px;
}

.styled-table.history-table{
    width:max-content;
    min-width:1450px;
    table-layout:auto;
    font-size:13px;
}

.styled-table.history-table th,
.styled-table.history-table td{
    white-space:nowrap;
    padding:10px 8px;
    overflow:visible;
    text-overflow:clip;
}

.styled-table.history-table .col-date{
    white-space:normal;
    min-width:78px;
    line-height:1.15;
}

.styled-table.history-table .col-comments{
    white-space:normal;
    min-width:150px;
    max-width:230px;
    overflow-wrap:anywhere;
}

.styled-table.history-table .col-action{
    min-width:74px;
    text-align:center;
}


/* COMPACT TABLE (Tea Dispatch Fix) */
/* COMPACT TABLE - CLEAN & TIGHT */
.compact-table {
    font-size: 12px;
    line-height: 1.2;
}

.compact-table th,
.compact-table td {
    padding: 4px 6px;   
    vertical-align: middle;
    white-space: nowrap;
}

/* Header tighter */
.compact-table thead th {
    padding: 5px 6px;
    font-size: 11.5px;
    font-weight: 600;
}

/* Reduce row height */
.compact-table tr {
    height: 32px;
}

/* Comments wrap nicely */
.compact-table .col-comments {
    white-space: normal;
    max-width: 160px;
    line-height: 1.3;
}

/* Date + Created compact */
.compact-table td:nth-child(2),
.compact-table td:nth-child(11) {
    font-size: 11px;
    line-height: 1.2;
}

/* Center numeric columns */
.compact-table td:nth-child(4),
.compact-table td:nth-child(5),
.compact-table td:nth-child(6),
.compact-table td:nth-child(7),
.compact-table td:nth-child(8),
.compact-table td:nth-child(9) {
    text-align: center;
}

/* Reduce button size */
.compact-table .btn-primary {
    padding: 4px 8px;
    font-size: 11px;
}

/* FORCE COMPACT TABLE OVERRIDE */
.styled-table.compact-table td {
    padding: 4px 6px !important;
}

.styled-table.compact-table th {
    padding: 5px 6px !important;
}

.styled-table.compact-table {
    font-size: 12px;
    line-height: 1.2;
}

.styled-table.compact-table tr {
    height: 30px;
}

/* Center numeric columns */
.styled-table.compact-table td:nth-child(4),
.styled-table.compact-table td:nth-child(5),
.styled-table.compact-table td:nth-child(6),
.styled-table.compact-table td:nth-child(7),
.styled-table.compact-table td:nth-child(8),
.styled-table.compact-table td:nth-child(9) {
    text-align: center;
}

/* Smaller buttons */
.styled-table.compact-table .btn-primary {
    padding: 3px 8px !important;
    font-size: 11px;
}

/* APP TABLE - SAAS STYLE (REUSABLE, DENSE) */
.app-table{
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    table-layout:auto;
    font-size:12.5px;
    line-height:1.25;
    color:#111827;
    border:1px solid #e5e7eb;
    border-radius:8px;
    overflow:hidden;
}

.app-table thead th{
    background:#f8fafc;
    color:#374151;
    font-weight:600;
    text-align:left;
    border-bottom:1px solid #e5e7eb;
    border-right:1px solid #e5e7eb;
    padding:6px 8px;
    height:32px;
    white-space:nowrap;
}

.app-table thead th:last-child{
    border-right:none;
}

.app-table tbody td{
    text-align:left;
    border-bottom:1px solid #e5e7eb;
    border-right:1px solid #e5e7eb;
    padding:4px 8px;
    height:30px;
    vertical-align:middle;
    white-space:nowrap;
}

.app-table tbody td:last-child{
    border-right:none;
}

.app-table tbody tr:last-child td{
    border-bottom:none;
}

.app-table tbody tr:hover{
    background:#f3f4f6;
}

/* Numeric alignment helpers */
.app-table .num,
.app-table .numeric,
.app-table td[data-type='number'],
.app-table th[data-type='number']{
    text-align:center;
}

/* Required helper columns */
.app-table .col-date{
    width:110px;
    min-width:96px;
    white-space:nowrap;
}

.app-table .col-comments{
    min-width:180px;
    max-width:320px;
    white-space:normal;
    overflow-wrap:anywhere;
    word-break:break-word;
    line-height:1.3;
}

.app-table .col-action{
    width:92px;
    min-width:80px;
    text-align:center;
    white-space:nowrap;
}

/* Compact action controls */
.app-table .col-action .btn,
.app-table .col-action button,
.app-table .col-action .btn-primary,
.app-table .col-action a.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:3px 7px;
    font-size:11px;
    line-height:1.1;
    min-height:24px;
    border-radius:5px;
}
