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

:root {
    --clr-bg:       #f4f6f8;
    --clr-surface:  #ffffff;
    --clr-border:   #dde1e7;
    --clr-primary:  #4a7cf7;
    --clr-primary-h:#3a6ce0;
    --clr-text:     #1a1d23;
    --clr-muted:    #6b7280;
    --clr-danger:   #dc2626;
    --clr-success:  #16a34a;
    --clr-warn:     #d97706;
    --nav-h:        56px;
    --radius:       6px;
    --shadow:       0 1px 4px rgba(0,0,0,.08);
}

html { font-size: 15px; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--clr-bg); color: var(--clr-text); line-height: 1.55; }

a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Navbar ===== */
.navbar {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; gap: 1rem;
    height: var(--nav-h); padding: 0 1.25rem;
    background: var(--clr-surface); border-bottom: 1px solid var(--clr-border);
    box-shadow: var(--shadow);
}

.navbar-brand {
    font-weight: 700; font-size: 1rem; color: var(--clr-text);
    white-space: nowrap; margin-right: .5rem;
}
.navbar-brand:hover { text-decoration: none; }

.navbar-nav {
    display: flex; align-items: center; gap: .15rem;
    list-style: none; flex: 1;
}

.navbar-nav a {
    display: block; padding: .35rem .75rem;
    border-radius: var(--radius); color: var(--clr-muted);
    font-size: .9rem; transition: background .15s, color .15s;
}
.navbar-nav a:hover { background: var(--clr-bg); color: var(--clr-text); text-decoration: none; }
.navbar-nav a.active { background: #eef2ff; color: var(--clr-primary); font-weight: 600; }

.navbar-logout { margin-left: auto; }

/* ===== Container ===== */
.container { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.25rem; }

/* ===== Kortelės (cards) ===== */
.card {
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem;
    margin-bottom: 1rem;
}
.card-header { font-weight: 600; font-size: 1rem; margin-bottom: .75rem; padding-bottom: .6rem; border-bottom: 1px solid var(--clr-border); }

/* ===== Lentelės ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--clr-muted); padding: .5rem .75rem; border-bottom: 2px solid var(--clr-border); }
td { padding: .55rem .75rem; border-bottom: 1px solid var(--clr-border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8f9fb; }
td a { color: var(--clr-text); font-weight: 500; }
td a:hover { color: var(--clr-primary); text-decoration: none; }

/* ===== Statuso ženkliukai ===== */
.badge {
    display: inline-block; padding: .2rem .55rem;
    border-radius: 99px; font-size: .75rem; font-weight: 600; line-height: 1.3;
    white-space: nowrap;
}
.badge-new      { background: #dbeafe; color: #1d4ed8; }
.badge-drafted  { background: #fef9c3; color: #854d0e; }
.badge-answered { background: #dcfce7; color: #166534; }
.badge-ignored  { background: #f1f5f9; color: #64748b; }
.badge-escalated{ background: #fee2e2; color: #991b1b; }
.badge-pending  { background: #fef3c7; color: #92400e; }
.badge-sent     { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-ok       { background: #dcfce7; color: #166534; }
.badge-error    { background: #fee2e2; color: #991b1b; }
.badge-deleted  { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }
.badge-low_confidence { background: #fef3c7; color: #92400e; }

/* ===== Mygtukai ===== */
.btn {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .45rem .9rem; border-radius: var(--radius);
    font-size: .9rem; font-weight: 500; cursor: pointer;
    border: 1px solid transparent; transition: background .15s, border-color .15s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--clr-primary); color: #fff; border-color: var(--clr-primary); }
.btn-primary:hover { background: var(--clr-primary-h); border-color: var(--clr-primary-h); }
.btn-secondary{ background: var(--clr-surface); color: var(--clr-text); border-color: var(--clr-border); }
.btn-secondary:hover { background: var(--clr-bg); }
.btn-danger   { background: var(--clr-danger); color: #fff; border-color: var(--clr-danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-link { background: none; border: none; color: var(--clr-muted); cursor: pointer; font-size: .9rem; padding: .35rem .5rem; border-radius: var(--radius); }
.btn-link:hover { background: var(--clr-bg); color: var(--clr-text); }

/* ===== Formos ===== */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .35rem; }
.form-control {
    width: 100%; padding: .5rem .75rem;
    border: 1px solid var(--clr-border); border-radius: var(--radius);
    font-size: .95rem; font-family: inherit; background: var(--clr-surface);
    transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--clr-primary); box-shadow: 0 0 0 3px rgba(74,124,247,.15); }
textarea.form-control { min-height: 140px; resize: vertical; }
.form-hint { font-size: .8rem; color: var(--clr-muted); margin-top: .25rem; }

/* ===== Pranešimai ===== */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }

/* ===== Puslapio antraštė ===== */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .5rem; }
.page-title  { font-size: 1.3rem; font-weight: 700; }

/* ===== Metaduomenys (key: value) ===== */
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; font-size: .875rem; }
.meta-list dt { color: var(--clr-muted); white-space: nowrap; }
.meta-list dd { word-break: break-word; }

/* ===== Konteksto blokas (naudotas AI kontekstas) ===== */
.context-block { background: #f8f9fb; border: 1px solid var(--clr-border); border-radius: var(--radius); padding: .75rem 1rem; font-size: .85rem; color: var(--clr-muted); }

/* ===== Tuščia būsena ===== */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--clr-muted); }
.empty-state p { font-size: 1rem; }

/* ===== Skyriklis ===== */
hr { border: none; border-top: 1px solid var(--clr-border); margin: 1.25rem 0; }

/* ===== Veiksmai (action bar) ===== */
.action-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }

/* ===== Spinner ===== */
.spinner {
    display: inline-block; width: 16px; height: 16px; flex-shrink: 0;
    border: 2px solid #93c5fd; border-top-color: #1d4ed8;
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .navbar-nav { gap: 0; }
    .navbar-nav a { padding: .3rem .5rem; font-size: .82rem; }
    .container { padding: 1rem .75rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
}
