/* ===========================
   AXON ERP Design System
   Tokens + shared chrome
=========================== */

:root {
    --axon-bg: #0b1220;
    --axon-bg-elevated: #0f172a;
    --axon-panel: #111827;
    --axon-panel-2: #0b1220;
    --axon-line: #1f2937;
    --axon-line-strong: #334155;
    --axon-text: #e8eef8;
    --axon-text-strong: #f8fafc;
    --axon-muted: #94a3b8;
    --axon-primary: #2563eb;
    --axon-primary-hover: #1d4ed8;
    --axon-accent: #38bdf8;
    --axon-secondary: #0f172a;
    --axon-success: #16a34a;
    --axon-danger: #dc2626;
    --axon-warning: #d97706;
    --axon-radius-sm: 8px;
    --axon-radius: 12px;
    --axon-radius-lg: 16px;
    --axon-shadow: 0 12px 32px rgba(0, 0, 0, .28);
    --axon-font: "SF Pro Display", "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    --axon-space-1: 4px;
    --axon-space-2: 8px;
    --axon-space-3: 12px;
    --axon-space-4: 16px;
    --axon-space-5: 24px;
    --axon-focus: 0 0 0 3px rgba(37, 99, 235, .28);

    /* Alias used by premium / module partials */
    --ap-text: var(--axon-text);
    --ap-muted: var(--axon-muted);
    --ap-border: var(--axon-line);
    --ap-panel: var(--axon-panel);
    --ap-accent: var(--axon-primary);
}

.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;

    width:auto;
    min-width:auto;
    height:40px;

    padding:0 14px;

    border-radius:var(--axon-radius-sm);
    border:0;

    cursor:pointer;
    text-decoration:none !important;

    font-family:inherit;
    font-weight:700;
    font-size:14px;
    line-height:1;

    transition:background .18s ease, border-color .18s ease, transform .12s ease, box-shadow .18s ease;

    color:#fff !important;
    background:var(--axon-primary);
    white-space:nowrap;
}
.btn:focus-visible{
    outline:none;
    box-shadow:var(--axon-focus);
}
.btn-md{
    height:44px;
    padding:0 18px;
    font-size:15px;
}

.btn-lg{
    height:52px;
    padding:0 24px;
    font-size:16px;
    border-radius:var(--axon-radius);
}

.btn-block{
    width:100%;
}

.btn-small{
    min-width:auto;
    height:34px;
    padding:0 10px;
    font-size:13px;
    border-radius:var(--axon-radius-sm);
}
.btn:hover{
    background:var(--axon-primary-hover);
}

.btn-secondary{
    background:#374151;
}

.btn-secondary:hover{
    background:#4b5563;
}

.btn-success{
    background:var(--axon-success);
}

.btn-danger{
    background:var(--axon-danger);
}

.btn-warning{
    background:var(--axon-warning);
}

.btn:visited{
    color:#fff !important;
}

.btn:active{
    color:#fff !important;
    transform:translateY(1px);
}

.page-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:22px;
    gap:16px;
    flex-wrap:wrap;
}

.page-title{
    font-size:clamp(28px, 3vw, 36px);
    font-weight:800;
    letter-spacing:-.03em;
    margin-bottom:6px;
    color:var(--axon-text-strong);
}

.page-subtitle{
    color:var(--axon-muted);
    font-size:15px;
}

.toolbar{
    display:flex;
    gap:12px;
    align-items:center;
    flex-wrap:wrap;
}

.kpi-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
    gap:18px;
    margin:24px 0;
}

.kpi-card{
    background:var(--axon-panel);
    border:1px solid var(--axon-line);
    border-radius:var(--axon-radius-lg);
    padding:22px;
}

.kpi-label{
    color:var(--axon-muted);
    font-size:13px;
    margin-bottom:8px;
}

.kpi-value{
    font-size:30px;
    font-weight:800;
    letter-spacing:-.03em;
    color:var(--axon-text-strong);
}

.card{
    background:var(--axon-panel);
    border:1px solid var(--axon-line);
    border-radius:var(--axon-radius-lg);
    padding:22px;
    margin-bottom:18px;
}

.table-panel{
    background:var(--axon-panel);
    border:1px solid var(--axon-line);
    border-radius:var(--axon-radius-lg);
    padding:20px;
    overflow:hidden;
}

.filter-panel{
    background:var(--axon-panel);
    border:1px solid var(--axon-line);
    border-radius:var(--axon-radius-lg);
    padding:20px;
    margin-bottom:22px;
}

.badge{
    display:inline-block;
    padding:6px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
    background:#334155;
    color:#fff;
}

/* Empty list / empty panel */
.axon-empty{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:48px 24px;
    text-align:center;
    color:var(--axon-muted);
    border:1px dashed var(--axon-line-strong);
    border-radius:var(--axon-radius-lg);
    background:rgba(15,23,42,.45);
}
.axon-empty strong{
    color:var(--axon-text-strong);
    font-size:16px;
    font-weight:750;
}
.axon-empty p{
    margin:0;
    max-width:420px;
    font-size:14px;
    line-height:1.45;
}
.axon-empty .btn{margin-top:10px}

/* Shared data tables */
.axon-table-scroll{
    width:100%;
    overflow-x:auto;
    border-radius:calc(var(--axon-radius-lg) - 2px);
}
table.table,
table[data-list-key]{
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    font-size:12.5px;
}
table.table thead th,
table[data-list-key] thead th{
    position:sticky;
    top:0;
    z-index:2;
    background:#1e293b;
    color:#cbd5e1;
    font-size:11px;
    font-weight:700;
    letter-spacing:.01em;
    text-transform:none;
    text-align:left;
    padding:6px 8px;
    border-bottom:1px solid #64748b;
    border-right:1px solid #334155;
    white-space:nowrap;
    max-width:9.5rem;
    overflow:hidden;
    text-overflow:ellipsis;
}
table.table thead th:last-child,
table[data-list-key] thead th:last-child{border-right:0}
table.table tbody td,
table[data-list-key] tbody td{
    padding:5px 8px;
    border-bottom:1px solid rgba(31,41,55,.85);
    border-right:1px solid rgba(30,41,59,.7);
    color:var(--axon-text);
    vertical-align:middle;
    font-size:12.5px;
    line-height:1.25;
    white-space:nowrap;
    max-width:14rem;
    overflow:hidden;
    text-overflow:ellipsis;
}
table.table tbody td:last-child,
table[data-list-key] tbody td:last-child{border-right:0}
table.table tbody tr:nth-child(even) td,
table[data-list-key] tbody tr:nth-child(even) td{
    background:rgba(30,41,59,.35);
}
table.table tbody tr:hover td,
table[data-list-key] tbody tr:hover td{
    background:rgba(37,99,235,.1);
}
.axon-cell-main{
    display:block;
    color:var(--axon-text-strong);
    font-weight:700;
    text-decoration:none;
}
.axon-cell-main:hover{color:var(--axon-accent)}
.axon-cell-sub{
    display:block;
    margin-top:2px;
    color:var(--axon-muted);
    font-size:12px;
}

/* Lightweight toast */
.axon-toast-host{
    position:fixed;
    right:16px;
    bottom:16px;
    z-index:13000;
    display:flex;
    flex-direction:column;
    gap:8px;
    pointer-events:none;
}
.axon-toast{
    pointer-events:auto;
    min-width:220px;
    max-width:360px;
    padding:12px 14px;
    border-radius:12px;
    border:1px solid var(--axon-line);
    background:#0f172a;
    color:var(--axon-text);
    box-shadow:var(--axon-shadow);
    font-size:13px;
    font-weight:600;
    animation:axon-toast-in .2s ease;
}
.axon-toast.is-error{border-color:rgba(220,38,38,.45);background:#1c1214}
.axon-toast.is-ok{border-color:rgba(22,163,74,.4);background:#0f1a14}
@keyframes axon-toast-in{
    from{opacity:0;transform:translateY(8px)}
    to{opacity:1;transform:none}
}

/* List skeleton */
.axon-skeleton-row td{
    position:relative;
    overflow:hidden;
}
.axon-skeleton-row td::after{
    content:"";
    display:block;
    height:12px;
    border-radius:6px;
    background:linear-gradient(90deg,#1e293b 0%,#334155 50%,#1e293b 100%);
    background-size:200% 100%;
    animation:axon-shimmer 1.2s linear infinite;
}
@keyframes axon-shimmer{
    from{background-position:200% 0}
    to{background-position:-200% 0}
}

/* ===========================
   AXON FORM ELEMENTS
=========================== */

.content label{
    display:block;
    color:var(--axon-muted);
    font-size:13px;
    font-weight:650;
    margin-bottom:7px;
    letter-spacing:.01em;
}

.content input,
.content select,
.content textarea{
    width:100%;
    min-height:44px;
    background:var(--axon-panel-2);
    color:var(--axon-text);
    border:1px solid var(--axon-line-strong);
    border-radius:var(--axon-radius-sm);
    padding:10px 12px;
    box-sizing:border-box;
    font-family:inherit;
    font-size:14px;
    outline:none;
    transition:border-color .15s ease, box-shadow .15s ease;
}

.content input:focus,
.content select:focus,
.content textarea:focus{
    border-color:var(--axon-primary);
    box-shadow:var(--axon-focus);
}

.content input::placeholder,
.content textarea::placeholder{
    color:var(--axon-muted);
}

.content input[type="date"]{
    color-scheme:dark;
}

.content input[type="checkbox"],
.content input[type="radio"]{
    width:auto;
    min-height:auto;
    accent-color:var(--axon-primary);
}

.content textarea{
    min-height:110px;
    resize:vertical;
}

/* ===========================
   AXON FORM GRIDS
=========================== */

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

.form-grid-3{
    display:grid;
    grid-template-columns:repeat(3,minmax(180px,1fr));
    gap:14px;
}

.form-grid-4{
    display:grid;
    grid-template-columns:repeat(4,minmax(160px,1fr));
    gap:14px;
}

.form-grid-filter{
    display:grid;
    grid-template-columns:minmax(180px,1fr) minmax(160px,1fr) minmax(160px,1fr) minmax(160px,1fr) 150px;
    gap:14px;
    align-items:end;
}

.form-grid-filter .btn{
    height:40px;
    min-width:auto;
}

.form-actions{
    margin-top:20px;
    display:flex;
    gap:12px;
    align-items:center;
    flex-wrap:wrap;
}

.table-actions{
    display:flex;
    gap:8px;
    align-items:center;
    white-space:nowrap;
}

.btn-small{
    min-width:auto;
    height:38px;
    padding:0 12px;
    font-size:13px;
}
.action-btn{
    min-width:auto;
    height:40px;
}
.table-wrap{
    width:100%;
    overflow-x:auto;
}

.axon-table{
    width:100%;
    min-width:1100px;
    border-collapse:collapse;
}

.axon-table th,
.axon-table td{
    padding:14px 12px;
    border-bottom:1px solid #1f2937;
    text-align:left;
    white-space:nowrap;
    vertical-align:middle;
}

.axon-table th{
    color:#94a3b8;
    background:#0f172a;
    font-size:13px;
}

.axon-table td{
    font-size:14px;
}

@media(max-width:1100px){
    .form-grid-filter{
        grid-template-columns:1fr 1fr;
    }

    .form-grid-3,
    .form-grid-4{
        grid-template-columns:repeat(2,minmax(160px,1fr));
    }
}

@media(max-width:700px){
    .form-grid-2,
    .form-grid-3,
    .form-grid-4,
    .form-grid-filter{
        grid-template-columns:1fr;
    }

    .form-grid-filter .btn{
        width:100%;
    }
}

.axon-lookup { position: relative; width: 100%; }
.axon-lookup-native,
select.axon-lookup-native[hidden] {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 1px !important;
    max-height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}
.axon-lookup-input {
    width: 100%;
    min-height: 40px;
    box-sizing: border-box;
    background: #020617;
    color: #e8eef8;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 8px 12px;
}
.axon-session-field .axon-lookup-input,
.axon-session-panel .axon-lookup-input {
    height: 42px;
    min-height: 42px;
    background: #020617;
    color: #e8eef8;
}
.axon-lookup-list {
    position: absolute;
    z-index: 80;
    left: 0; right: 0;
    top: 100%;
    margin-top: 4px;
    max-height: 280px;
    overflow: auto;
    background: #0b1220;
    border: 1px solid #334155;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
.axon-lookup-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    color: #e8eef8;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
}
.axon-lookup-item.is-active,
.axon-lookup-item:hover { background: #1e293b; }
.axon-lookup-empty { padding: 10px 12px; color: #8b9bb4; font-size: 13px; }

.axon-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}
.axon-pager-meta {
    margin: 0;
    color: #94a3b8;
    font-size: 13px;
}
.axon-pager-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.axon-pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #020617;
    color: #e8eef8;
    text-decoration: none;
    font-size: 13px;
    line-height: 1;
    box-sizing: border-box;
}
a.axon-pager-btn:hover {
    background: #1e293b;
    border-color: #475569;
}
.axon-pager-btn.is-on {
    background: #1d4ed8;
    border-color: #2563eb;
    color: #fff;
}
.axon-pager-btn.is-off {
    opacity: .4;
    pointer-events: none;
}

/* Laravel default pagination uses Tailwind w-5/h-5 SVGs; without Tailwind they fill the viewport. */
nav[role="navigation"] svg,
svg.w-5,
svg.h-5 {
    width: 1.25rem !important;
    height: 1.25rem !important;
    max-width: 1.25rem;
    max-height: 1.25rem;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ===========================
   Form required / optional UX
=========================== */

.axon-field-optional,
.ap-page input.axon-field-optional,
.ap-page select.axon-field-optional,
.ap-page textarea.axon-field-optional,
.content input.axon-field-optional,
.content select.axon-field-optional,
.content textarea.axon-field-optional {
    background: rgba(250, 204, 21, 0.08) !important;
    border-color: rgba(202, 138, 4, 0.45) !important;
}

.axon-field-required,
.ap-page input.axon-field-required,
.ap-page select.axon-field-required,
.ap-page textarea.axon-field-required,
.content input.axon-field-required,
.content select.axon-field-required,
.content textarea.axon-field-required {
    border-color: rgba(148, 163, 184, 0.55);
}

.axon-field-invalid,
.ap-page input.axon-field-invalid,
.ap-page select.axon-field-invalid,
.ap-page textarea.axon-field-invalid,
.content input.axon-field-invalid,
.content select.axon-field-invalid,
.content textarea.axon-field-invalid {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.14) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.28) !important;
}

.axon-field-invalid-wrap > span:first-child,
.axon-field-invalid-wrap > label:first-child {
    color: #fca5a5;
}

.axon-form-missing {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.55);
    background: rgba(127, 29, 29, 0.35);
    color: #fecaca;
    font-size: 13px;
    line-height: 1.4;
}
.axon-form-missing strong {
    display: block;
    margin-bottom: 4px;
    color: #fee2e2;
}
