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

body {
    font: 13px/1.5 'Courier New', Courier, monospace;
    background: #fff;
    color: #111;
}

/* ── Navigation ─────────────────────────────────────────── */
nav {
    background: #1a1a1a;
    padding: 5px 12px;
    display: flex;
    align-items: center;
    gap: 0;
}
nav a {
    color: #c9c9c9;
    text-decoration: none;
    font-size: 12px;
    padding: 3px 10px;
    border-right: 1px solid #333;
}
nav a:first-child { padding-left: 0; }
nav a:hover, nav a.active { color: #fff; }

/* ── Page wrapper ────────────────────────────────────────── */
main {
    padding: 10px 14px;
    max-width: 1100px;
}

h1 { font-size: 13px; font-weight: bold; margin-bottom: 6px; }
h2 { font-size: 12px; font-weight: bold; margin: 14px 0 4px; }
h2 small { font-weight: normal; font-size: 11px; margin-left: 8px; }
h2 small a { font-size: 11px; }
p  { font-size: 12px; margin-bottom: 6px; }

/* ── Tables ──────────────────────────────────────────────── */
table {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
    margin-bottom: 10px;
}
th, td {
    border: 1px solid #ccc;
    padding: 2px 6px;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}
td.wrap { white-space: normal; }
th { background: #f0f0f0; font-weight: bold; }
tr:hover td { background: #fafafa; }

/* ── Detail table (key/value pairs) ─────────────────────── */
table.detail th {
    text-align: right;
    width: 120px;
    font-weight: normal;
    color: #555;
    background: none;
    border-color: #e0e0e0;
}
table.detail td { border-color: #e0e0e0; white-space: normal; }

/* ── Form table ──────────────────────────────────────────── */
table.form-tbl { width: auto; border: none; margin-bottom: 0; }
table.form-tbl th,
table.form-tbl td {
    border: none;
    padding: 3px 6px;
    background: none;
    white-space: normal;
}
table.form-tbl th {
    text-align: right;
    width: 140px;
    font-weight: normal;
    color: #555;
    vertical-align: middle;
    white-space: nowrap;
}
table.form-tbl td { vertical-align: middle; }
table.form-tbl tr:hover td,
table.form-tbl tr:hover th { background: none; }

/* ── Form controls ───────────────────────────────────────── */
input[type=text], input[type=date], input[type=number],
input[type=email], select, textarea {
    font: 12px 'Courier New', Courier, monospace;
    border: 1px solid #aaa;
    padding: 2px 4px;
    color: #111;
    background: #fff;
}
input[type=text]:focus, input[type=date]:focus,
input[type=number]:focus, select:focus, textarea:focus {
    outline: 2px solid #338;
    outline-offset: 0;
}
textarea { vertical-align: top; resize: vertical; }
button, input[type=submit] {
    font: 12px 'Courier New', Courier, monospace;
    padding: 2px 10px;
    cursor: pointer;
    border: 1px solid #888;
    background: #eee;
}
button:hover, input[type=submit]:hover { background: #ddd; }

/* ── Page header row ─────────────────────────────────────── */
.page-hdr {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

/* ── Flash / alert messages ──────────────────────────────── */
.msg {
    display: inline-block;
    font-size: 12px;
    padding: 3px 8px;
    margin-bottom: 8px;
    border: 1px solid;
}
.msg.ok  { color: #1a5c1a; background: #efffef; border-color: #b2d8b2; }
.msg.err { color: #7a0000; background: #fff0f0; border-color: #f0bbbb; }

/* ── Status labels ───────────────────────────────────────── */
.s-overdue  { color: #aa0000; font-weight: bold; }
.s-due      { color: #886600; font-weight: bold; }
.s-upcoming { color: #003399; }
.s-ok       { color: #1a5c1a; }

/* ── Inline action forms ─────────────────────────────────── */
form.inline { display: inline; margin: 0; }
main a { color: #00c; }
main a:visited { color: #551a8b; }

/* ── Tag input widget ────────────────────────────────────────────────────── */
.tag-input-wrap {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    border: 1px solid #aaa;
    padding: 1px 3px;
    min-width: 280px;
    min-height: 22px;
    background: #fff;
    cursor: text;
    font-size: 12px;
    position: relative;
    vertical-align: middle;
}
.tag-input-wrap:focus-within { outline: 2px solid #338; outline-offset: 0; }
.tag-pill-box { display: inline-flex; flex-wrap: wrap; gap: 2px; }
.tag-pill {
    display: inline-flex;
    align-items: center;
    background: #e8e8ff;
    border: 1px solid #99a;
    padding: 0 1px 0 3px;
    font-size: 11px;
    white-space: nowrap;
    font-family: 'Courier New', Courier, monospace;
}
.tag-pill button {
    border: none;
    background: none;
    padding: 0 2px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    color: #555;
}
.tag-pill button:hover { color: #900; background: none; }
.tag-text {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-width: 80px;
    flex: 1;
    font: 12px 'Courier New', Courier, monospace;
    background: transparent;
}
.tag-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid #aaa;
    border-top: none;
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 100%;
    max-height: 150px;
    overflow-y: auto;
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
}
.tag-dropdown li { padding: 2px 6px; cursor: pointer; white-space: nowrap; }
.tag-dropdown li:hover { background: #eef; }

/* ── Muted text (e.g. pending/future rows) ───────────────────────────────── */
.muted { color: #999; }

/* ── Photo thumbnail grid (asset detail) ─────────────────────────────────── */
.thumb-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}
.thumb-grid a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    overflow: hidden;
    flex-shrink: 0;
}
.thumb-grid a:hover {
    border-color: #888;
    background: #e8e8e8;
}
.thumb-grid img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
}
