/* PITS Portal - close PIRP adaptation */

:root {
    --bg-body:      #0a0a0a;
    --bg-panel:     #141414;
    --bg-inset:     #0d0d0d;
    --bg-raised:    #1c1c1c;
    --bg-hover:     rgba(212,136,42,0.06);
    --bg-highlight: #222222;

    --accent:       #d4882a;
    --accent-hover: #e8a042;
    --accent-muted: rgba(212,136,42,0.12);
    --accent-dim:   rgba(212,136,42,0.45);

    --text:         #c8c8c8;
    --text-bright:  #f0f0f0;
    --text-muted:   #6b6b6b;
    --text-dim:     #454545;

    --border-dark:  #1a1a1a;
    --border-mid:   #272727;
    --border-light: #3a3a3a;

    --success:        #22c55e;
    --success-bg:     rgba(34,197,94,0.08);
    --success-border: rgba(34,197,94,0.25);
    --warning:        #f59e0b;
    --warning-bg:     rgba(245,158,11,0.08);
    --warning-border: rgba(245,158,11,0.28);
    --error:          #ef4444;
    --error-bg:       rgba(239,68,68,0.08);
    --error-border:   rgba(239,68,68,0.28);
    --info:           #5b8fd6;

    --radius:    2px;
    --font-mono: "Consolas", "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text);
    background: var(--bg-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
::selection { background: rgba(212,136,42,0.28); color: var(--text-bright); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: #2a2a2a; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

header {
    background: linear-gradient(180deg, #1c1c1c 0%, rgba(10,10,10,0.97) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-mid);
    display: flex;
    align-items: stretch;
    gap: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    align-self: stretch;
}

.portal-h1-brand {
    width: 180px;
    height: 40px;
    padding: 0 20px;
    white-space: nowrap;
    border-right: 1px solid var(--border-mid);
    display: flex;
    align-items: center;
    overflow: hidden;
    text-indent: -9999px;
    background: url('/assets/pirp-logo-text.png') no-repeat center;
    background-size: 140px auto;
    flex-shrink: 0;
    text-decoration: none;
}

header nav {
    display: flex;
    gap: 0;
    align-items: stretch;
    flex: 1;
    overflow-x: auto;
    position: relative;
}

header nav a {
    padding: 0 15px;
    height: 40px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.12s, background 0.12s;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

header nav a svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    opacity: 0.45;
    flex-shrink: 0;
    transition: opacity 0.12s;
}

header nav a:hover svg,
header nav a.active svg { opacity: 1; }

header nav a:hover {
    color: var(--text-bright);
    background: rgba(255,255,255,0.03);
    text-decoration: none;
}

header nav a.active {
    color: #1a0a00;
    font-weight: 700;
    text-decoration: none;
}

.nav-active-indicator {
    position: absolute;
    top: 0;
    left: 0;
    height: 40px;
    width: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.18) 0, rgba(255,255,255,0.05) 2px, transparent 2px),
        linear-gradient(180deg, #e29b3d 0%, #d4882a 52%, #aa6517 100%);
    border-top: 1px solid rgba(255,255,255,0.22);
    border-bottom: 1px solid rgba(0,0,0,0.38);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.1),
        inset 0 -1px 0 rgba(0,0,0,0.28),
        0 0 0 1px rgba(170,101,23,0.3),
        0 8px 18px rgba(0,0,0,0.22);
    clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%);
    pointer-events: none;
    z-index: 0;
    transition: transform 0.34s cubic-bezier(.16,.84,.24,1), width 0.22s cubic-bezier(.3,.8,.3,1), opacity 0.12s linear;
    will-change: transform, width;
}

.portal-nav-user {
    display: flex;
    align-items: center;
    padding: 0 14px 0 10px;
    font-size: 12px;
    color: var(--text-dim);
    border-left: 1px solid var(--border-dark);
    margin-left: auto;
    white-space: nowrap;
    gap: 5px;
}

.portal-nav-user::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
}

main {
    padding: 20px 28px;
    width: min(1100px, calc(100vw - 56px));
    margin: 0 auto;
}

section {
    margin-bottom: 10px;
}

section h2 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 6px 12px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: linear-gradient(180deg, #222 0%, #1a1a1a 100%);
    border: 1px solid var(--border-mid);
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

section h2 a {
    color: var(--text-muted);
    font-weight: 400;
    text-decoration: none;
}

section h2 a:hover { color: var(--text-bright); text-decoration: none; }
section h2 .section-sep { color: var(--text-dim); margin: 0 2px; }

section > div,
section > form,
section > table {
    background: linear-gradient(160deg, #181818 0%, #141414 100%);
    border: 1px solid var(--border-mid);
    border-top: none;
    padding: 10px 12px;
}

section > table {
    padding: 0;
    overflow: hidden;
}

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-hover);
    background: linear-gradient(180deg, rgba(212,136,42,.18) 0%, rgba(212,136,42,.08) 100%);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.12s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.5;
}

button:hover, .button:hover {
    background: rgba(212,136,42,0.2);
    border-color: var(--accent);
    color: var(--accent-hover);
    text-decoration: none;
}

button.secondary, .button-secondary {
    background: linear-gradient(180deg, #242424 0%, #1a1a1a 100%);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
}

button.secondary:hover, .button-secondary:hover {
    background: var(--bg-highlight);
    border-color: #4a4a4a;
    color: var(--text-bright);
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

label input,
label select,
label textarea,
input,
select,
textarea {
    display: block;
    width: 100%;
    margin-top: 3px;
    padding: 5px 8px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-bright);
    background: rgba(13,13,13,0.9);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    transition: border-color 0.12s, box-shadow 0.12s;
    line-height: 1.5;
}

label input:focus,
label select:focus,
label textarea:focus,
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-dim);
    box-shadow: 0 0 0 2px var(--accent-muted);
}

textarea { min-height: 50px; resize: vertical; }
select option { background: #181818; }

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border: 1px solid var(--border-light);
    background: var(--bg-inset);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    vertical-align: middle;
    display: inline-block;
    transition: border-color 0.1s, background 0.1s;
}

input[type="checkbox"]:hover { border-color: var(--accent-dim); }
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px; top: 0;
    width: 5px; height: 8px;
    border: 1.5px solid #111;
    border-top: none; border-left: none;
    transform: rotate(42deg);
}

.form-group { margin-bottom: 10px; }
.form-hint { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

table.list {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.list th {
    text-align: left;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(180deg, #222 0%, #1a1a1a 100%);
    border-bottom: 1px solid var(--border-mid);
    white-space: nowrap;
}

table.list td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-dark);
    color: var(--text);
    vertical-align: middle;
}

table.list tbody tr:hover td { background: var(--bg-hover); }

.success, p.success, .msg-success {
    padding: 7px 12px;
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    border-left: 3px solid var(--success);
    color: var(--success);
    margin-bottom: 8px;
    font-size: 12px;
}

.error, p.error, .msg-error {
    padding: 7px 12px;
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-left: 3px solid var(--error);
    color: #f87171;
    margin-bottom: 8px;
    font-size: 12px;
}

.info {
    padding: 7px 12px;
    background: rgba(91,143,214,0.08);
    border: 1px solid rgba(91,143,214,0.28);
    border-left: 3px solid var(--info);
    color: var(--info);
    margin-bottom: 8px;
    font-size: 12px;
}

.badge,
.badge-success,
.badge-warning,
.badge-danger,
.badge-info,
.badge-neutral,
.badge-error,
.status-badge,
.prio-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: 1px solid;
}

.badge-open       { background: rgba(212,136,42,0.10); color: var(--accent); border-color: rgba(212,136,42,0.30); }
.badge-inprogress { background: rgba(212,136,42,0.10);  color: var(--accent);  border-color: rgba(212,136,42,0.30); }
.badge-waiting    { background: rgba(245,158,11,0.10);  color: var(--warning); border-color: rgba(245,158,11,0.30); }
.badge-resolved   { background: rgba(34,197,94,0.10);   color: var(--success); border-color: rgba(34,197,94,0.25); }
.badge-closed     { background: rgba(60,60,60,0.10);    color: var(--text-muted); border-color: rgba(60,60,60,0.30); }

.prio-low      { background: rgba(60,60,60,0.10);    color: var(--text-muted); border-color: rgba(60,60,60,0.30); }
.prio-normal   { background: rgba(255,255,255,0.04);  color: var(--text-muted); border-color: rgba(255,255,255,0.10); }
.prio-high     { background: rgba(212,136,42,0.08);  color: var(--accent);     border-color: rgba(212,136,42,0.25); }
.prio-critical { background: rgba(239,68,68,0.08);   color: var(--error);      border-color: rgba(239,68,68,0.25); }

.badge-success  { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge-danger,
.badge-error    { background: var(--error-bg); color: #f87171; border-color: var(--error-border); }
.badge-warning  { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge-info     { background: rgba(212,136,42,0.10); color: var(--accent); border-color: rgba(212,136,42,0.30); }
.badge-neutral  { background: var(--bg-raised); color: var(--text-muted); border-color: var(--border-light); }

.module-subnav {
    display: flex;
    gap: 2px;
    padding: 4px 8px;
    margin-bottom: 10px;
    overflow-x: auto;
    background: var(--bg-panel);
    border: 1px solid var(--border-mid);
}

.module-subnav a {
    padding: 4px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: all 0.12s;
    white-space: nowrap;
}

.module-subnav a:hover {
    background: var(--bg-raised);
    color: var(--text-bright);
    text-decoration: none;
    border-color: var(--border-light);
}

.module-subnav a.active {
    background: var(--accent-muted);
    color: var(--accent);
    border-color: var(--accent-dim);
}

.portal-thread { }

.portal-reply {
    margin-bottom: 10px;
    border: 1px solid var(--border-mid);
    padding: 12px 14px;
    background: rgba(255,255,255,0.03);
}

.portal-reply-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 10px;
    font-size: 12px;
}

.portal-reply-author { font-weight: 600; color: var(--text-bright); }

.portal-reply-time {
    margin-left: auto;
    color: var(--text-dim);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.portal-reply.portal-reply-staff {
    border-color: rgba(212,136,42,0.38);
    background: rgba(212,136,42,0.08);
}

.portal-reply.portal-reply-customer {
    border-color: rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.03);
}

.portal-reply.portal-reply-staff .portal-reply-author { color: var(--accent); }

.portal-reply-body {
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

.portal-reply-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding-top: 10px;
}

.portal-attach-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--bg-raised);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.1s;
}

.portal-attach-link:hover {
    color: var(--text-bright);
    border-color: var(--border-light);
    text-decoration: none;
}

.mono, code {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    background: var(--bg-raised);
    padding: 1px 5px;
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
}

.portal-login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-body);
    padding: 20px;
}

.portal-login-box {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    width: 360px;
    max-width: 100%;
    overflow: hidden;
}

.portal-login-header {
    padding: 22px 28px 18px;
    background: linear-gradient(180deg, #1c1c1c 0%, #111111 100%);
    border-bottom: 1px solid var(--border-mid);
}

.portal-login-company {
    height: 40px;
    background: url('/assets/pirp-logo-text.png') no-repeat left center;
    background-size: 140px auto;
    text-indent: -9999px;
    overflow: hidden;
    margin-bottom: 10px;
}

.portal-login-subtitle {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .6px;
}

.portal-login-body {
    padding: 22px 28px 26px;
}

.portal-login-title {
    font-size: 18px;
    color: var(--text-bright);
    margin-bottom: 14px;
}

.portal-login-footer {
    padding: 14px 28px;
    border-top: 1px solid var(--border-dark);
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-bright { color: var(--text-bright); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-accent { color: var(--accent); }
.text-mono { font-family: var(--font-mono); font-size: 12px; }
.nowrap { white-space: nowrap; }

@media (max-width: 768px) {
    header { flex-wrap: wrap; }
    .portal-h1-brand { width: 100%; border-right: none; border-bottom: 1px solid var(--border-mid); }
    main { width: 100%; padding: 10px 12px; }
    .portal-login-box { width: 100%; }
}
