.tl-page { font-family: 'lato'; color: #cfe2e1; }
.tl-page a { color: #7fd3d1; }
.tl-page a:hover { color: #c9f1f0; }

/* Owner section nav */
.tl-nav {
    display: flex; flex-wrap: wrap; margin: 0 0 18px; padding: 4px;
    background: #0f1a1c; border: 1px solid #1d3439; border-radius: 10px;
}
.tl-page a.tl-nav-item {
    display: inline-flex; align-items: center; height: 34px; margin: 2px; padding: 0 14px; border-radius: 7px;
    font: bold 14px 'lato'; color: #9cc9c7; text-decoration: none; white-space: nowrap;
}
.tl-page a.tl-nav-item:hover { background: #14282d; color: #e6f0f0; }
.tl-page a.tl-nav-on, .tl-page a.tl-nav-on:hover { background: #1f7a77; color: #f0fbfa; }
/* Where the eight items no longer fit on one line (they need about 680px),
   the same bar and pills are laid out as two even rows of four, nothing to
   scroll sideways. A little taller there, for thumbs. */
@media (max-width: 739px) {
    .tl-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .tl-page a.tl-nav-item { justify-content: center; height: 40px; padding: 0 4px; }
}
@media (max-width: 359px) {
    .tl-page a.tl-nav-item { padding: 0 2px; font-size: 13px; }
}
.tl-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; }
.tl-modes { display: inline-flex; padding: 3px; background: #0f1a1c; border: 1px solid #1d3439; border-radius: 8px; }
.tl-mode { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 6px; font: bold 14px 'lato'; color: #9cc9c7; text-decoration: none; }
a.tl-mode:hover { background: #14282d; color: #e6f0f0; }
.tl-mode-on { background: #1f7a77; color: #f0fbfa; }
.tl-links { margin-left: auto; display: flex; flex-wrap: wrap; }
.tl-links .tl-btn + .tl-btn { margin-left: 8px; }
.tl-intro { max-width: 780px; margin: 0 0 14px; font: 15px/1.6 'lato'; color: #a9c9c7; }
.tl-intro strong { color: #e6f0f0; }
.tl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 12px; }
.tl-search {
    flex: 1 1 240px; max-width: 380px; height: 38px; box-sizing: border-box;
    padding: 0 12px 0 34px; border-radius: 6px; border: 1px solid #22393e; color: #e6f0f0; font: 15px 'lato';
    -webkit-appearance: none; appearance: none;
    background: #0f1a1c url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2378b2b0' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center;
}
.tl-search:focus { outline: none; border-color: #1ba3a5; box-shadow: 0 0 0 2px rgba(27, 163, 165, 0.25); }
.tl-count { margin-left: auto; font: 14px 'lato'; color: #8fb3b1; }
/* Case view: the count stays beside the search and the buttons sit together
   on the right, moving to their own line as one group when space runs out */
.tl-toolbar-case .tl-count { margin-left: 0; }
.tl-toolbar-btns { display: flex; flex-wrap: wrap; align-items: center; margin: -4px 0 -4px auto; }
.tl-toolbar-btns > * { margin: 4px 0 4px 8px; }
.tl-toolbar-btns > [hidden] { display: none; }

/* Item cards */
.tl-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-gap: 10px; gap: 10px;
    padding: 12px; background: #0c1315; border: 1px solid #1d3439; border-radius: 8px;
}
.tl-card, .tl-dcard, .tl-vcard {
    position: relative; display: flex; flex-direction: column; align-items: center;
    box-sizing: border-box; padding: 30px 10px 12px; background: #0f1a1c; border: 1px solid #1d3439; border-radius: 8px; text-align: center;
    content-visibility: auto; contain-intrinsic-size: auto 230px;
}
.tl-card > * + *, .tl-dcard > * + * { margin-top: 8px; }
.tl-card[hidden], .tl-vcard[hidden] { display: none; }
.tl-card:hover, .tl-dcard:hover { border-color: #2c4a4f; }
/* Place pills sit in the gap above the centered picture, clear of it */
.tl-ribbon, .tl-pos {
    position: absolute; top: 3px; left: 3px; margin: 0; min-width: 22px; height: 16px; padding: 0 7px; box-sizing: border-box;
    border-radius: 8px; background: #14282d; color: #8fc3c1; font: bold 11px/16px 'lato'; text-align: center; white-space: nowrap;
}
.tl-card > .tl-ribbon + *, .tl-dcard > .tl-pos + * { margin-top: 0; }
.tl-ribbon, .tl-pos-top { background: #2a2410; box-shadow: inset 0 0 0 1px #7a6420; color: #e8c86a; }
.tl-card img, .tl-dcard img, .tl-vcard img { width: 80px; height: 80px; object-fit: contain; }

/* Item pictures sit in a black display area. On the cards it fills the top of
   the card edge to edge and the name sits below on the card's color, in list
   rows it is a black square with room around the picture. Many older item
   images have black drawn in around the item and newer ones are transparent:
   inside the black area both look the same. Only the drawing changes, the
   image files are untouched. */
.tl-pic { display: flex; align-items: center; justify-content: center; flex: none; line-height: 0; background: #000; }
.tl-pic img { display: block; }
.tl-vcard .tl-vlink > .tl-pic, .tl-dcard > .tl-pic, .tl-card > .tl-pic {
    align-self: stretch; height: 112px; border-radius: 7px 7px 0 0;
}
.tl-vcard .tl-vlink > .tl-pic { margin: -14px -10px 0; }
.tl-vlink > .tl-pic + *, .tl-dcard > .tl-pic + *, .tl-card > .tl-pic + * { margin-top: 10px; }
.tl-name {
    min-height: 35px; font: 13px/1.35 'lato'; color: #e6f0f0; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tl-box {
    width: 72px; height: 38px; box-sizing: border-box; padding: 0 4px; text-align: center;
    border-radius: 6px; border: 1px solid #263f44; background: #152124; color: #fff; font: bold 17px 'lato';
}
.tl-box:focus { outline: none; border-color: #1ba3a5; box-shadow: 0 0 0 2px rgba(27, 163, 165, 0.3); }
.tl-note { min-height: 16px; font: 12px/1.35 'lato'; color: #6f9896; }
.tl-moved { border-color: #1ba3a5; background: #0f2224; }
.tl-moved .tl-box { border-color: #1ba3a5; background: #10302f; }
.tl-moved .tl-note { color: #5fd0cf; }
.tl-out { border-color: #6b2525; background: #1a1012; }
.tl-out img, .tl-out .tl-name { opacity: 0.45; }
.tl-out .tl-box { border-color: #c0392b; }
.tl-out .tl-note { color: #ff8a80; }
.tl-bad { border-color: #6b2525; }
.tl-bad .tl-box { border-color: #c0392b; background: #2a1414; }
.tl-bad .tl-note { color: #ff8a80; }
.tl-none { grid-column: 1 / -1; padding: 28px; text-align: center; font: 15px 'lato'; color: #6f9896; }
.tl-none[hidden] { display: none; }

/* Drag and drop grid. Sortable 1.4.2 treats a flex row as a side-by-side
   layout, the same way it treated the old floated list, so drops land the same. */
.tl-dgrid {
    list-style: none; display: flex; flex-wrap: wrap; align-items: flex-start; margin: 0; padding: 3px; min-height: 120px;
    background: #0c1315; border: 1px solid #1d3439; border-radius: 8px;
}
.tl-dcard { cursor: grab; -webkit-user-select: none; user-select: none; contain-intrinsic-size: auto 190px; }
.tl-dcard.sortable-chosen { border-color: #1ba3a5; }
.tl-dcard.sortable-ghost { border: 2px dashed #1ba3a5; background: #10302f; }
.tl-dcard.sortable-ghost > * { opacity: 0.35; }
.tl-dcard.sortable-fallback { box-shadow: 0 14px 30px rgba(0, 0, 0, 0.65); opacity: 0.95 !important; }
body.tl-dragging, body.tl-dragging .tl-dcard { cursor: grabbing; }
.tl-flash { animation: tlFlash 1.6s ease-out; }
@keyframes tlFlash { 0%, 30% { border-color: #5fd0cf; box-shadow: 0 0 0 3px rgba(95, 208, 207, 0.45); } 100% { box-shadow: 0 0 0 0 rgba(95, 208, 207, 0); } }
@media (max-width: 1023px) {
    /* Press and hold to drag on touch screens, the browser must not treat it as a scroll */
    .tl-dgrid, .tl-dcard { touch-action: none; -webkit-touch-callout: none; }
    .sortable-fallback img { pointer-events: none; }
}
.tl-touch-only { display: none; }
@media (hover: none) and (pointer: coarse) {
    .tl-touch-only { display: inline; }
    .tl-mouse-only { display: none; }
}

/* Bottom bar */
.tl-bar {
    position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
    margin-top: 12px; padding: 12px 16px; background: #14282d; border: 1px solid #1d3439; border-radius: 8px;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.45); font: 15px 'lato'; color: #cfe2e1;
}
.tl-problem, .tl-link { padding: 0; border: 0; background: none; font: 14px 'lato'; text-decoration: underline; cursor: pointer; }
.tl-problem { color: #ff8a80; }
.tl-link { color: #9fe3e1; font-weight: bold; }
.tl-link:hover { color: #fff; }
.tl-problem[hidden], .tl-btn[hidden] { display: none; }
.tl-bar-buttons { margin-left: auto; display: flex; }
.tl-bar-buttons .tl-btn + .tl-btn { margin-left: 8px; }
a.tl-btn, button.tl-btn {
    display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; height: 38px; padding: 0 18px;
    border-radius: 6px; border: 1px solid transparent; font: bold 15px 'lato'; cursor: pointer; text-decoration: none;
}
a.tl-btn-small { height: 32px; padding: 0 14px; font-size: 14px; }
a.tl-btn-primary, button.tl-btn-primary { background: #1f7a77; color: #f0fbfa; }
a.tl-btn-primary:hover, button.tl-btn-primary:hover { background: #26918d; color: #fff; }
button.tl-btn-primary:disabled { background: #22393c; color: #6f8f8d; cursor: not-allowed; }
a.tl-btn-secondary, button.tl-btn-secondary { background: transparent; border-color: #2c4a4f; color: #9cc9c7; }
a.tl-btn-secondary:hover, button.tl-btn-secondary:hover { border-color: #1ba3a5; color: #d5f0ef; }

/* Drag and drop bar: save status, then the take-out zone */
.tl-status { flex: 1 1 260px; display: flex; flex-wrap: wrap; align-items: center; min-height: 40px; font: 15px/1.4 'lato'; color: #a9c9c7; }
.tl-status > * + * { margin-left: 8px; }
.tl-status strong { color: #fff; }
.tl-status::before { content: ''; flex: none; width: 0; height: 18px; margin-right: 0; border-radius: 50%; background-position: center; background-repeat: no-repeat; background-size: 12px; }
.tl-status-saving::before { width: 16px; height: 16px; margin-right: 10px; border: 2px solid #2c4a4f; border-top-color: #5fd0cf; animation: tlSpin 0.8s linear infinite; }
.tl-status-ok { color: #cfe2e1; }
.tl-status-ok::before {
    width: 20px; height: 20px; margin-right: 10px; background-color: #1f8a6f;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E");
}
.tl-status-error { color: #ff8a80; }
.tl-status-error::before {
    width: 20px; height: 20px; margin-right: 10px; background-color: #c0392b;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 6v8M12 18v.5'/%3E%3C/svg%3E");
}
@keyframes tlSpin { to { transform: rotate(360deg); } }
.tl-zone {
    flex: 1 1 300px; display: flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 54px; padding: 6px 14px;
    border: 2px dashed #3a5559; border-radius: 8px; color: #8fb3b1; font: bold 14px/1.3 'lato'; text-align: center;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.tl-zone::before {
    content: ''; flex: none; width: 22px; height: 22px; margin-right: 10px; background-repeat: no-repeat; background-position: center;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238fb3b1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 13v6a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-6'/%3E%3Cpath d='M12 3v11M7.5 9.5L12 14l4.5-4.5'/%3E%3C/svg%3E");
}
body.tl-dragging .tl-zone { border-color: #b0453a; background: #1f1214; color: #ffb3a9; }
.tl-zone.tl-zone-over { border-style: solid; border-color: #ff6b5b; background: #5a1d1d; color: #fff; }
.tl-zone.tl-zone-over::before, body.tl-dragging .tl-zone::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffb3a9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 13v6a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-6'/%3E%3Cpath d='M12 3v11M7.5 9.5L12 14l4.5-4.5'/%3E%3C/svg%3E");
}

/* Banners and the empty case */
.tl-result { display: flex; align-items: center; margin: 0 0 14px; padding: 14px 16px; border: 1px solid; border-radius: 8px; font: 15px/1.45 'lato'; color: #d5ecea; }
.tl-result strong { color: #fff; }
.tl-result::before {
    content: ''; flex: none; width: 24px; height: 24px; margin-right: 12px; border-radius: 50%;
    background-position: center; background-size: 14px; background-repeat: no-repeat;
}
.tl-result-ok { background: #0f2a26; border-color: #1f6f5c; }
.tl-result-ok::before { background-color: #1f8a6f; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E"); }
.tl-result-info { background: #0f2224; border-color: #1f6f6c; }
.tl-result-info::before { background-color: #1f7a77; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); background-size: 15px; }
.tl-result .tl-btn { margin-left: auto; flex: none; }
.tl-result-warn { background: #2a2410; border-color: #7a6420; }
.tl-result-warn::before { background-color: #b08a1e; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 6v8M12 18v.5'/%3E%3C/svg%3E"); }
.tl-empty { padding: 32px 16px; text-align: center; background: #0c1315; border: 1px solid #1d3439; border-radius: 8px; font: 15px/1.6 'lato'; color: #a9c9c7; }
.tl-empty .tl-btn { margin-top: 12px; }

/* Case view cards (index.php): the image and name open the item window */
.tl-vcard { padding: 14px 10px 12px; contain-intrinsic-size: auto 172px; }
.tl-vcard:hover { border-color: #2c4a4f; background: #11201f; }
.tl-page .tl-vlink { display: flex; flex-direction: column; align-items: center; width: 100%; color: inherit; text-decoration: none; }
.tl-vlink > * + * { margin-top: 8px; }
.tl-page a.tl-vlink:hover .tl-name { color: #fff; text-decoration: underline; }
.tl-vlink:focus { outline: 2px solid #1ba3a5; outline-offset: 4px; border-radius: 6px; }
/* Card markers, stacked down the top left corner so they stay clear of the
   picture: a gold quill when the item has a caption, a teal speech bubble when
   it has comments */
.tl-flags { position: absolute; top: 7px; left: 7px; display: flex; flex-direction: column; transform-origin: 0 0; transition: opacity 260ms ease, transform 260ms ease; }
/* Hide icons: fade and shrink into the corner, then hide for real so the tooltips go too */
.tl-flags-off .tl-flags { opacity: 0; transform: scale(0.6); visibility: hidden; transition: opacity 260ms ease, transform 260ms ease, visibility 0s linear 260ms; }
@media (prefers-reduced-motion: reduce) { .tl-flags, .tl-flags-off .tl-flags { transition: none; } }
.tl-flags > * + * { margin-top: 4px; }
.tl-flag { display: block; width: 22px; height: 22px; border-radius: 50%; background: #14282d no-repeat center; background-size: 13px; }
.tl-flag-comment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237fd3d1' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
}
/* The whole caption badge (fill, gold ring and quill) is one SVG: a thin
   inset box-shadow ring on a rounded box draws patchy in Chrome */
.tl-flag-caption {
    background-color: transparent; background-size: 22px 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='10.25' fill='%232a2410' stroke='%239a7d28' stroke-width='1.5'/%3E%3Cg transform='translate(4 4) scale(0.5833)' fill='none' stroke='%23e8c86a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.24 12.24a6 6 0 0 0-8.49-8.49L5 10.5V19h8.5zM16 8 2 22M17.5 15H9'/%3E%3C/g%3E%3C/svg%3E");
}
.tl-page a.tl-act {
    position: absolute; top: 6px; right: 6px; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px;
    border-radius: 6px; background: #14282d; color: #9cc9c7; text-decoration: none;
}
.tl-page a.tl-act:hover { background: #1f7a77; color: #fff; }
.tl-navtoggle[hidden] { display: none; }
@media (max-width: 1023px) { button.tl-btn.tl-navtoggle { display: none; } }

/* Item grids on the case view and both re-order pages: exactly the old case
   page's columns, 3 per row below 768px and 6 from 768px up (its Bootstrap
   col-xs-4 col-sm-2), whatever the room. Users arrange their cases in rows of
   6 and 3, so the counts never change, Hide nav included, and the re-order
   pages show the same rows the visitors see. Pictures stay at their true 80px
   (nearly all item images are 80x80), the cards around them shrink or grow. */
.tl-grid.tl-grid-case, .tl-grid.tl-grid-legacy { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-gap: 6px; gap: 6px; padding: 6px; }
.tl-grid.tl-grid-case { container-type: inline-size; container-name: tlcase; }
.tl-dcard { width: calc(100% / 3 - 6px); margin: 3px; }
@media (min-width: 768px) {
    .tl-grid.tl-grid-case, .tl-grid.tl-grid-legacy { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .tl-dcard { width: calc(100% / 6 - 6px); }
}
@media (min-width: 1024px) {
    .tl-grid.tl-grid-case, .tl-grid.tl-grid-legacy { grid-gap: 8px; gap: 8px; padding: 8px; }
    .tl-dgrid { padding: 4px; }
    .tl-dcard { width: calc(100% / 6 - 8px); margin: 4px; }
}

/* The narrow cards: the black stage runs edge to edge across the top with the
   picture centered in it, and names may run to a third line as on the old page */
.tl-grid-case .tl-vcard, .tl-grid-legacy .tl-card, .tl-dcard { padding: 8px 4px; }
.tl-grid-case .tl-vcard .tl-vlink > .tl-pic, .tl-grid-legacy .tl-card > .tl-pic, .tl-dcard > .tl-pic { margin: -8px -4px 0; }
.tl-grid-case .tl-vlink > .tl-pic + *, .tl-grid-legacy .tl-card > .tl-pic + *, .tl-dcard > .tl-pic + * { margin-top: 8px; }
.tl-grid-case .tl-name, .tl-grid-legacy .tl-name, .tl-dcard .tl-name { -webkit-line-clamp: 3; }
@media (max-width: 767px) {
    .tl-grid-case .tl-name, .tl-grid-legacy .tl-name, .tl-dcard .tl-name { font-size: 12px; }
}
@media (min-width: 1024px) {
    .tl-grid-case .tl-vcard, .tl-grid-legacy .tl-card, .tl-dcard { padding: 10px 6px; }
    .tl-grid-case .tl-vcard .tl-vlink > .tl-pic, .tl-grid-legacy .tl-card > .tl-pic, .tl-dcard > .tl-pic { margin: -10px -6px 0; }
    .tl-grid-case .tl-vlink > .tl-pic + *, .tl-grid-legacy .tl-card > .tl-pic + *, .tl-dcard > .tl-pic + * { margin-top: 10px; }
}

/* Re-order cards: the 120px stage leaves 20px above the picture for the place
   pill. Drag cards are all one height (every name keeps room for three lines)
   so rows never shift mid-drag. Legacy boxes line up along each row. */
.tl-grid-legacy .tl-card > .tl-pic, .tl-dcard > .tl-pic { height: 120px; }
.tl-dcard { container-type: inline-size; }
.tl-dcard .tl-name { height: 4.05em; min-height: 0; }
.tl-grid-legacy .tl-card .tl-name { margin-bottom: 8px; }
.tl-grid-legacy .tl-card .tl-box { margin-top: auto; }
/* The first five say "On user info" beside the number where the card has the
   room, on the narrowest phones the gold number alone */
.tl-pos-more { display: none; }
@container (min-width: 84px) { .tl-pos-more { display: inline; } }

/* Case view icons. Below 1024px there is no room beside the picture, so the
   quill, bubble and actions button sit in one centered row under the name.
   The card wraps: the picture and name take the first line, the icons follow
   on the next, held at the bottom of the card so they line up across each row
   (cards in a row are one height). Cards without icons have no row. */
.tl-grid-case .tl-vcard { contain-intrinsic-size: auto 160px; }
.tl-grid-case .tl-vcard .tl-vlink > .tl-pic { height: 104px; }
.tl-grid-case .tl-flag { width: 18px; height: 18px; background-size: 11px; }
.tl-grid-case .tl-flag-caption { background-size: 18px 18px; }
@media (max-width: 1023px) {
    .tl-grid-case .tl-vcard { flex-flow: row wrap; justify-content: center; align-items: center; align-content: space-between; }
    .tl-page .tl-grid-case .tl-vlink { flex: 0 0 100%; }
    .tl-grid-case .tl-name { min-height: 0; }
    .tl-grid-case .tl-flags, .tl-page .tl-grid-case a.tl-act { position: static; order: 1; margin-top: 6px; }
    /* As tall as the actions button, so every icon row in a grid row shares one center line */
    .tl-grid-case .tl-flags { flex-direction: row; align-items: center; height: 24px; transform: none; }
    .tl-grid-case .tl-flags > * + * { margin-top: 0; margin-left: 4px; }
    .tl-grid-case .tl-flags + a.tl-act { margin-left: 4px; }
    .tl-grid-case .tl-flag-comment { box-shadow: inset 0 0 0 1px #2c4a4f; }
    .tl-page .tl-grid-case a.tl-act { width: 24px; height: 24px; box-sizing: border-box; border: 1px solid #2c4a4f; font-size: 13px; }

    /* Hide icons: the quill and bubble fade, then close up so a lone actions
       button glides to the center (and a row with only those icons folds
       away). Show icons runs it backward: open up, then fade in. */
    .tl-grid-case .tl-flags { transition: opacity 160ms ease 160ms, margin 160ms ease, height 160ms ease, visibility 0s; }
    .tl-grid-case .tl-flag { transition: width 160ms ease, height 160ms ease, margin 160ms ease; }
    .tl-grid-case .tl-flags + a.tl-act { transition: margin 160ms ease; }
    .tl-grid-case.tl-flags-off .tl-flags { opacity: 0; transform: none; visibility: hidden; margin-top: 0; height: 0; transition: opacity 160ms ease, margin 160ms ease 160ms, height 160ms ease 160ms, visibility 0s linear 320ms; }
    .tl-grid-case.tl-flags-off .tl-flag { width: 0; height: 0; margin-left: 0; transition: width 160ms ease 160ms, height 160ms ease 160ms, margin 160ms ease 160ms; }
    .tl-grid-case.tl-flags-off .tl-flags + a.tl-act { margin-left: 0; transition: margin 160ms ease 160ms; }
}
@media (prefers-reduced-motion: reduce) {
    .tl-grid-case .tl-flags, .tl-grid-case .tl-flag, .tl-grid-case .tl-flags + a.tl-act { transition: none !important; }
}
/* 1024px and up: beside the picture, stacked */
@media (min-width: 1024px) {
    .tl-grid-case .tl-vcard .tl-vlink > .tl-pic { height: 100px; }
    .tl-grid-case .tl-flags { top: 4px; left: 3px; }
    .tl-grid-case .tl-flags > * + * { margin-top: 3px; }
    .tl-page .tl-grid-case a.tl-act { top: 4px; right: 2px; width: 20px; height: 20px; font-size: 12px; border-radius: 5px; }

    /* Hide nav: still 6 per row, each item gets a bigger stage, full-size
       icons and a larger name. Keyed to the grid's own width, so it also
       switches at the right moment while the nav slides away. 950px: below
       that a card has under 33px beside its picture, too little for the
       full-size actions button (nav shown the grid is about 820px). */
    @container tlcase (min-width: 950px) {
        .tl-grid-case .tl-vcard { padding: 14px 10px 12px; contain-intrinsic-size: auto 190px; }
        .tl-grid-case .tl-vcard .tl-vlink > .tl-pic { margin: -14px -10px 0; height: 132px; }
        .tl-grid-case .tl-vlink > .tl-pic + * { margin-top: 10px; }
        .tl-grid-case .tl-name { font-size: 14px; }
        .tl-grid-case .tl-flags { top: 8px; left: 8px; }
        .tl-grid-case .tl-flags > * + * { margin-top: 4px; }
        .tl-grid-case .tl-flag { width: 22px; height: 22px; background-size: 13px; }
        .tl-grid-case .tl-flag-caption { background-size: 22px 22px; }
        .tl-page .tl-grid-case a.tl-act { top: 7px; right: 7px; width: 26px; height: 26px; font-size: 14px; border-radius: 6px; }
    }
}

/* Panels (manage, settings, share, cases) */
.tl-panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); grid-gap: 12px; gap: 12px; margin-bottom: 14px; }
.tl-panel {
    box-sizing: border-box; margin-bottom: 14px; padding: 16px 18px; background: #0f1a1c; border: 1px solid #1d3439; border-radius: 10px;
    font: 15px/1.6 'lato'; color: #cfe2e1;
}
.tl-panels > .tl-panel { margin-bottom: 0; }
.tl-panel-title { margin: 0 0 12px; padding-left: 10px; border-left: 3px solid #1ba3a5; font: bold 16px/1.4 'lato'; color: #d5ecea; }
.tl-panel p { margin: 0 0 10px; }
.tl-panel-actions { display: flex; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.tl-panel-actions .tl-btn { margin: 0 8px 8px 0; }
.tl-row { display: flex; align-items: center; }
.tl-row > .tl-pic { margin-right: 14px; padding: 10px; border-radius: 8px; }
.tl-row img { width: 80px; height: 80px; object-fit: contain; }
.tl-meter { height: 10px; margin: 6px 0 4px; overflow: hidden; background: #14282d; border-radius: 5px; }
.tl-meter > span { display: block; height: 100%; background: linear-gradient(90deg, #1f7a77, #1ba3a5); border-radius: 5px; }
.tl-meter-text { display: flex; justify-content: space-between; font: 14px 'lato'; color: #8fb3b1; }
.tl-meter-text strong { color: #fff; }
.tl-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-gap: 8px; gap: 8px; }
.tl-stat { padding: 10px 12px; background: #0c1315; border: 1px solid #1d3439; border-radius: 8px; }
.tl-stat-num { display: block; font: bold 22px/1.2 'lato'; color: #fff; }
.tl-stat-label { display: block; font: 12px/1.4 'lato'; color: #8fb3b1; }
.tl-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border: 1px solid; border-radius: 12px; font: bold 12px/1 'lato'; vertical-align: middle; }
.tl-pill-ok { background: #0f2a26; border-color: #1f6f5c; color: #8fe0c8; }
.tl-pill-warn { background: #2a2410; border-color: #7a6420; color: #e8c86a; }
.tl-pill-muted { background: #14282d; border-color: #2c4a4f; color: #9cc9c7; }

/* Owner text blocks: case description, captions */
.tl-desc, .tl-caption { overflow: hidden; overflow-wrap: anywhere; color: #e6f0f0; }
.tl-desc { margin: 0 0 14px; padding: 16px 18px; background: #0f1a1c; border: 1px solid #1d3439; border-radius: 10px; font: 15px/1.6 'lato'; }
.tl-caption { padding: 10px 12px; background: #0c1315; border: 1px solid #1d3439; border-radius: 8px; font: 14px/1.6 'lato'; }
.tl-desc img, .tl-caption img, .tl-comment-text img { max-width: 100%; height: auto; }
.tl-desc img.emojione, .tl-caption img.emojione, .tl-comment-text img.emojione { width: 22px; height: 22px; vertical-align: -5px; }

/* Comments */
.tl-comment { display: flex; margin-bottom: 10px; padding: 14px 16px; background: #0f1a1c; border: 1px solid #1d3439; border-radius: 10px; }
.tl-comment > .tl-pic { margin-right: 14px; align-self: flex-start; padding: 8px; border-radius: 8px; }
.tl-comment-thumb { width: 64px; height: 64px; object-fit: contain; }
.tl-comment-body { flex: 1; min-width: 0; }
.tl-comment-item { margin-bottom: 4px; font: bold 15px/1.4 'lato'; color: #d5ecea; }
.tl-comment-meta { margin-bottom: 8px; font: 13px/1.4 'lato'; color: #8fb3b1; }
.tl-comment-meta strong { color: #e6f0f0; }
.tl-comment-text { font: 15px/1.6 'lato'; color: #e6f0f0; overflow-wrap: anywhere; }
.tl-comment-actions { margin-top: 10px; }
.tl-comment-actions form { display: inline; margin: 0; }
button.tl-btn-danger, a.tl-btn-danger { background: transparent; border-color: #6b2525; color: #ff8a80; }
button.tl-btn-danger:hover, a.tl-btn-danger:hover { background: #2a1414; border-color: #c0392b; color: #ffb3a9; }
button.tl-btn-small { height: 32px; padding: 0 14px; font-size: 14px; }

/* Forms */
.tl-form { max-width: 680px; }
.tl-field { margin-bottom: 20px; }
.tl-label { display: block; margin: 0 0 6px; font: bold 15px/1.4 'lato'; color: #d5ecea; }
.tl-help { margin: -2px 0 8px; font: 13px/1.5 'lato'; color: #8fb3b1; }
.tl-page .tl-input, .tl-page .tl-textarea, .tl-pop .tl-textarea {
    display: block; width: 100%; max-width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid #263f44; border-radius: 6px;
    background: #0c1416; color: #e6f0f0; font: 15px/1.5 'lato'; -webkit-appearance: none; appearance: none;
}
.tl-page .tl-input { height: 40px; }
.tl-page .tl-textarea, .tl-pop .tl-textarea { min-height: 130px; resize: vertical; }
.tl-page .tl-input:focus, .tl-page .tl-textarea:focus, .tl-pop .tl-textarea:focus { outline: none; border-color: #1ba3a5; box-shadow: 0 0 0 2px rgba(27, 163, 165, 0.25); }
.tl-choice { display: flex; align-items: flex-start; margin: 0 0 8px; padding: 10px 12px; background: #0f1a1c; border: 1px solid #1d3439; border-radius: 8px; font: 15px/1.45 'lato'; color: #cfe2e1; cursor: pointer; }
.tl-choice:hover { border-color: #2c4a4f; }
.tl-choice input { flex: none; width: 16px; height: 16px; margin: 2px 10px 0 0; accent-color: #1ba3a5; }
.tl-actions { display: flex; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.tl-actions .tl-btn { margin: 0 8px 8px 0; }

/* Share */
.tl-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); grid-gap: 12px; gap: 12px; margin-bottom: 14px; }
button.tl-option {
    display: flex; flex-direction: column; align-items: flex-start; box-sizing: border-box; width: 100%; padding: 16px 18px; text-align: left;
    background: #0f1a1c; border: 1px solid #1d3439; border-radius: 10px; color: #cfe2e1; cursor: pointer; font-family: 'lato';
}
button.tl-option:hover, button.tl-option:focus { border-color: #1ba3a5; background: #11201f; outline: none; }
.tl-option-title { font: bold 16px/1.4 'lato'; color: #fff; }
.tl-option-text { margin-top: 4px; font: 14px/1.5 'lato'; color: #8fb3b1; }
.tl-social { display: flex; flex-wrap: wrap; margin: 0 0 6px; padding: 0; list-style: none; }
.tl-social li { margin: 0 8px 8px 0; }
.tl-social a { display: block; padding: 6px; background: #0c1315; border: 1px solid #1d3439; border-radius: 8px; }
.tl-social a:hover { border-color: #1ba3a5; }
.tl-social img { display: block; width: 36px; height: 36px; }
.tl-copy { display: flex; }
.tl-copy .tl-input { flex: 1; min-width: 0; margin-right: 8px; }
.tl-checktools { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.tl-checktools .tl-search { margin-right: 10px; }
.tl-checklist {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); grid-gap: 4px; gap: 4px; max-height: 340px; overflow: auto;
    padding: 8px; background: #0c1315; border: 1px solid #1d3439; border-radius: 8px;
}
.tl-check { display: flex; align-items: center; padding: 6px 8px; border-radius: 6px; font: 14px 'lato'; color: #cfe2e1; cursor: pointer; }
.tl-check:hover { background: #14282d; }
.tl-check[hidden] { display: none; }
.tl-check input { width: 16px; height: 16px; margin: 0 8px 0 0; accent-color: #1ba3a5; }

/* Captions list and the add item list */
.tl-list { overflow: hidden; background: #0c1315; border: 1px solid #1d3439; border-radius: 10px; }
.tl-listrow { display: flex; align-items: flex-start; padding: 14px 16px; border-top: 1px solid #172a2e; content-visibility: auto; contain-intrinsic-size: auto 110px; }
.tl-listrow:first-child { border-top: 0; }
.tl-listrow[hidden] { display: none; }
.tl-listrow > .tl-pic { margin-right: 14px; padding: 8px; border-radius: 8px; }
.tl-listrow .tl-pic img { width: 64px; height: 64px; object-fit: contain; }
.tl-listrow-body { flex: 1; min-width: 0; }
.tl-listrow-title { margin-bottom: 6px; font: bold 15px/1.4 'lato'; color: #e6f0f0; }
.tl-listrow-sub { font: 13px 'lato'; color: #8fb3b1; }
.tl-listrow-side { flex: none; margin-left: 12px; align-self: center; }
.tl-listrow-compact { align-items: center; padding: 8px 14px; contain-intrinsic-size: auto 66px; }
.tl-listrow-compact > .tl-pic { padding: 6px; }
.tl-listrow-compact .tl-pic img { width: 48px; height: 48px; }
.tl-listrow-compact .tl-listrow-title { margin-bottom: 2px; }

/* Cases */
.tl-casecard { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; }
.tl-casecard > .tl-pic { align-self: stretch; height: 140px; margin: -16px -18px 14px; border-radius: 9px 9px 0 0; }
.tl-casecard img { width: 100px; height: 100px; object-fit: contain; }
.tl-casecard .tl-pill { position: absolute; top: 12px; right: 12px; }
.tl-casecard-name { font: bold 16px/1.4 'lato'; color: #fff; }
.tl-casecard-limit { margin-top: 4px; font: bold 22px/1.3 'lato'; color: #7fd3d1; }
.tl-casecard-note { margin-top: 4px; font: 14px/1.5 'lato'; color: #8fb3b1; }
.tl-casecard-on { border-color: #1ba3a5; background: #0f2224; }

/* Item window (caption.php in the case page's pop-up and as its own small page) */
.tl-pop { box-sizing: border-box; max-width: 480px; margin: 0 auto; padding: 6px 4px 4px; font: 15px/1.6 'lato'; color: #cfe2e1; text-align: left; }
.tl-pop a { color: #7fd3d1; }
.tl-pop-head { display: flex; align-items: center; margin-bottom: 14px; }
.tl-pop-head > .tl-pic { margin-right: 14px; padding: 10px; border-radius: 8px; }
.tl-pop-head img { width: 80px; height: 80px; object-fit: contain; }
.tl-pop-title { margin: 0; font: bold 18px/1.35 'lato'; color: #fff; text-transform: none; letter-spacing: normal; }
.tl-pop-sub { font: 13px/1.4 'lato'; color: #8fb3b1; }
.tl-pop-actions { display: flex; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.tl-pop-actions .tl-btn { margin: 0 8px 8px 0; }
.tl-pop .tl-comment { padding: 12px 14px; }
.tl-pop .tl-label { margin-top: 4px; }
.tl-pop .tl-help { margin-top: 8px; }
.tl-pop .tl-empty { padding: 20px 12px; }
body.tl-popbody { margin: 0; padding: 18px 16px; background: #0b1213; }

@media (max-width: 600px) {
    .tl-links { margin-left: 0; }
    .tl-count { margin-left: 0; width: 100%; }
    .tl-toolbar-btns { margin-left: -8px; }
    .tl-listrow-side { margin-left: 8px; }
    .tl-bar-buttons { margin-left: 0; width: 100%; }
    .tl-bar-buttons .tl-btn { flex: 1; }
    .tl-zone { min-height: 50px; }
}
