/* DWMonitor — card-based, mobile-first */
:root {
    --green:  #1e9e4a; --green-bg:  #e6f6ec;
    --yellow: #d99a06; --yellow-bg: #fdf3d7;
    --red:    #d13438; --red-bg:    #fbe4e5;
    --gray:   #8a8f98; --gray-bg:   #eef0f2;
    --ink: #1c2430; --muted: #5b6572; --line: #dde2e8;
    --card: #ffffff; --bg: #f2f4f7; --accent: #1a6dcc;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.35rem; margin: 14px 0 12px; }
h2 { font-size: 1.05rem; margin: 20px 0 8px; }

.topbar { background: #16202e; color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1100px; margin: 0 auto; display: flex;
                align-items: center; justify-content: space-between; padding: 0 12px; }
.brand { color: #fff; font-weight: 700; padding: 12px 0; font-size: 1.05rem; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: #c9d4e2; padding: 12px 10px; border-bottom: 3px solid transparent; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; border-color: var(--accent); }
@media (max-width: 640px) { .topbar nav a span { display: none; } }

.wrap { max-width: 1100px; margin: 0 auto; padding: 8px 12px 40px; }
.foot { text-align: center; color: var(--muted); padding: 18px; font-size: .85rem; }

.cards { display: grid; gap: 12px;
         grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line);
        border-radius: 10px; padding: 14px; }
.card.link:hover { border-color: var(--accent); box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.card h3 { margin: 0 0 6px; font-size: 1rem; display: flex;
           align-items: center; gap: 8px; justify-content: space-between; }
.card .sub { color: var(--muted); font-size: .85rem; }
.card-red    { border-left: 5px solid var(--red); }
.card-yellow { border-left: 5px solid var(--yellow); }
.card-green  { border-left: 5px solid var(--green); }
.card-gray   { border-left: 5px solid var(--gray); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
        border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pill-green  { background: var(--green-bg);  color: var(--green); }
.pill-yellow { background: var(--yellow-bg); color: var(--yellow); }
.pill-red    { background: var(--red-bg);    color: var(--red); }
.pill-gray   { background: var(--gray-bg);   color: var(--gray); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-green { background: var(--green); } .dot-yellow { background: var(--yellow); }
.dot-red { background: var(--red); }     .dot-gray { background: var(--gray); }

.tiles { display: grid; gap: 10px;
         grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
        padding: 10px 12px; }
.tile .t-label { color: var(--muted); font-size: .78rem; text-transform: uppercase;
                 letter-spacing: .03em; }
.tile .t-value { font-size: 1.25rem; font-weight: 700; margin-top: 2px; }
.tile-green  { box-shadow: inset 0 -3px 0 var(--green); }
.tile-yellow { box-shadow: inset 0 -3px 0 var(--yellow); }
.tile-red    { box-shadow: inset 0 -3px 0 var(--red); }
.tile-gray   { box-shadow: inset 0 -3px 0 var(--gray); }

table.grid { width: 100%; border-collapse: collapse; background: var(--card);
             border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.grid th { text-align: left; font-size: .78rem; color: var(--muted);
                text-transform: uppercase; letter-spacing: .03em;
                padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line);
                vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr:hover td { background: #f7f9fb; }
.tblwrap { overflow-x: auto; }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line);
        margin: 12px 0; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600;
          border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.active { color: var(--ink); border-color: var(--accent); }

.rangetabs { display: inline-flex; gap: 4px; background: var(--card);
             border: 1px solid var(--line); border-radius: 8px; padding: 3px;
             margin: 6px 0 12px; }
.rangetabs a { padding: 5px 11px; border-radius: 6px; color: var(--muted);
               font-size: .85rem; font-weight: 600; }
.rangetabs a.active { background: var(--accent); color: #fff; }

.chartbox { background: var(--card); border: 1px solid var(--line);
            border-radius: 10px; padding: 10px; margin-bottom: 14px;
            position: relative; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
       border-radius: 8px; border: 1px solid var(--line); background: var(--card);
       color: var(--ink); font-weight: 600; font-size: .9rem; cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #145bb0; color: #fff; }
.btn-danger { color: var(--red); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }

form.stack label { display: block; font-weight: 600; font-size: .85rem;
                   margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=number], input[type=email],
select {
    width: 100%; max-width: 420px; padding: 8px 10px; border: 1px solid var(--line);
    border-radius: 8px; font-size: .95rem; background: #fff;
}
input:disabled { background: var(--gray-bg); color: var(--muted); }
.formrow { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-weight: 600; }
.flash-ok    { background: var(--green-bg); color: var(--green); }
.flash-warn  { background: var(--yellow-bg); color: var(--yellow); }
.flash-error { background: var(--red-bg); color: var(--red); }

.sparkline { height: 46px; margin-top: 8px; }

/* threshold editor */
.thr-table td { white-space: nowrap; }
.thr-table input[type=number] { width: 92px; }
.thr-preview { position: relative; height: 10px; border-radius: 5px; min-width: 130px;
    background: linear-gradient(to right, var(--green) 0 55%, var(--yellow) 55% 80%,
                var(--red) 80% 100%); }
.thr-preview.rev {
    background: linear-gradient(to right, var(--red) 0 20%, var(--yellow) 20% 45%,
                var(--green) 45% 100%); }
.thr-preview .cur { position: absolute; top: -4px; width: 6px; height: 18px;
    background: var(--ink); border-radius: 3px; border: 1px solid #fff; }

.loginbox { max-width: 380px; margin: 60px auto; background: var(--card);
    border: 1px solid var(--line); border-radius: 12px; padding: 26px; }
.loginbox h1 { text-align: center; }

.meta { color: var(--muted); font-size: .84rem; }
.right { text-align: right; }
.mt0 { margin-top: 0; }
