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

    :root {
      --bg:        #f5f2ec;
      --surface:   #ffffff;
      --border:    #e4dfd6;
      --text:      #1a1714;
      --muted:     #7a7470;
      --accent:    #c8673a;
      --accent-lt: #faeee7;
      --radius:    12px;
    }

    body {
      font-family: 'DM Sans', sans-serif;
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      padding: 0 1.5rem 3rem;
    }

    /* ── Header ── */
    header {
      max-width: 900px;
      margin: 0 auto;
      padding: 2.5rem 0 2rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid var(--border);
    }

    .logo {
      font-family: 'DM Serif Display', serif;
      font-size: 1.6rem;
      letter-spacing: -0.02em;
      color: var(--text);
      text-decoration: none;
    }

    .logo span { color: var(--accent); }

    nav a {
      font-size: 0.875rem;
      font-weight: 500;
      color: var(--muted);
      text-decoration: none;
      margin-left: 1.75rem;
      transition: color .2s;
    }
    nav a:hover { color: var(--text); }

    /* ── Search ── */
    .search-wrap {
      max-width: 900px;
      margin: 2.5rem auto 0;
    }

    .search-label {
      font-family: 'DM Serif Display', serif;
      font-size: 2rem;
      margin-bottom: 1rem;
      letter-spacing: -0.03em;
    }

    .search-bar {
      display: flex;
      align-items: center;
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: 50px;
      padding: 0.6rem 0.6rem 0.6rem 1.4rem;
      box-shadow: 0 2px 10px rgba(0,0,0,.05);
      transition: border-color .2s, box-shadow .2s;
    }
    .search-bar:focus-within {
      border-color: var(--accent);
      box-shadow: 0 2px 16px rgba(200,103,58,.12);
    }

    .search-bar input {
      flex: 1;
      border: none;
      outline: none;
      background: transparent;
      font-family: 'DM Sans', sans-serif;
      font-size: 1rem;
      color: var(--text);
      
  
    }
    .search-bar input::placeholder { color: var(--muted); }

    .search-engine {
      appearance: none;
      -webkit-appearance: none;
      -moz-appearance: none;
      border: none;
      outline: none;
      background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%237a7470' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right center;
      background-size: 0.6em;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.85rem;
      color: var(--muted);
      padding: 0.3rem 1.9rem 0.3rem 0;
      margin-right: 1rem;
      cursor: pointer;
      transition: color .2s;
      
    }
    .search-engine:hover,
    .search-engine:focus {
      color: var(--text);
    }
    .search-engine option {
      background: var(--surface);
      color: var(--text);
    }

    .search-btn {
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: 50px;
      padding: 0.55rem 1.4rem;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.9rem;
      font-weight: 500;
      cursor: pointer;
      transition: background .2s, transform .1s;
    }
    .search-btn:hover { background: #b5562e; }
    .search-btn:active { transform: scale(0.97); }

    /* ── Grid ── */
    .section-title {
      max-width: 900px;
      margin: 2.5rem auto 1rem;
      font-size: 0.75rem;
      font-weight: 500;
      letter-spacing: .12em;
      text-transform: uppercase;
      color: var(--muted);
    }

    .grid {
      max-width: 900px;
      margin: 0 auto;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 1rem;
    }

    .card {
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: var(--radius);
      padding: 1.25rem 1.25rem 1.1rem;
      text-decoration: none;
      color: var(--text);
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      transition: border-color .2s, box-shadow .2s, transform .15s;
    }
    .card:hover {
      border-color: var(--accent);
      box-shadow: 0 4px 18px rgba(200,103,58,.1);
      transform: translateY(-2px);
    }

    .card-icon {
      width: 40px;
      height: 40px;
      border-radius: 10px;
      background: var(--accent-lt);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.2rem;
      margin-bottom: 0.25rem;
    }

    .card-name {
      font-weight: 500;
      font-size: 0.95rem;
    }

    .card-desc {
      font-size: 0.8rem;
      color: var(--muted);
      line-height: 1.4;
    }

    /* ── Enheter ── */
    .device-list {
      max-width: 900px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .device-row {
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: var(--radius);
      padding: 0.75rem 1.25rem;
      display: flex;
      align-items: center;
      gap: 1.5rem;
      font-size: 0.88rem;
      font-variant-numeric: tabular-nums;
    }

    .device-name {
      font-weight: 500;
      flex: 1;
    }

    .device-ip {
      font-weight: 400;
      font-size: 0.78rem;
      color: var(--muted);
      margin-left: 0.4rem;
    }

    .device-rx { color: #2a7a4f; }
    .device-tx { color: #c8673a; }

    .device-graph {
      width: 180px;
      height: 36px;
      flex-shrink: 0;
    }
    @media (max-width: 640px) {
      .device-graph { display: none; }
    }

    .device-placeholder {
      font-size: 0.85rem;
      color: var(--muted);
      padding: 0.5rem 0;
    }

    .device-block-btn {
      background: none;
      border: 1.5px solid var(--border);
      border-radius: 50px;
      padding: 0.4rem 0.9rem;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.78rem;
      font-weight: 500;
      color: var(--muted);
      cursor: pointer;
      flex-shrink: 0;
      transition: border-color .2s, color .2s, background .2s;
    }
    .device-block-btn:hover { border-color: var(--accent); color: var(--accent); }
    .device-block-btn:disabled { opacity: 0.6; cursor: default; }
    .device-block-btn.blocked {
      background: var(--accent);
      border-color: var(--accent);
      color: #fff;
    }
    .device-block-btn.blocked:hover { background: #b5562e; }

    /* ── Chatt ── */
    .chat-box {
      max-width: 900px;
      margin: 0 auto;
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: var(--radius);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .chat-messages {
      max-height: 280px;
      min-height: 80px;
      overflow-y: auto;
      padding: 1rem 1.25rem;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .chat-msg {
      font-size: 0.88rem;
      line-height: 1.4;
    }
    .chat-user {
      font-weight: 500;
      color: var(--accent);
    }
    .chat-time {
      font-size: 0.72rem;
      color: var(--muted);
      margin-left: 0.5rem;
    }
    .chat-del {
      background: none;
      border: none;
      color: var(--muted);
      cursor: pointer;
      font-size: 0.85rem;
      margin-left: 0.4rem;
      padding: 0 2px;
      line-height: 1;
      opacity: 0;
      transition: opacity .15s, color .15s;
    }
    .chat-msg:hover .chat-del { opacity: 1; }
    .chat-del:hover { color: #e05; }

    .chat-form {
      display: flex;
      gap: 0.5rem;
      padding: 0.75rem 1.25rem;
      border-top: 1px solid var(--border);
    }
    .chat-form input {
      border: 1.5px solid var(--border);
      border-radius: 50px;
      padding: 0.5rem 1rem;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.88rem;
      outline: none;
      background: var(--bg);
      color: var(--text);
      transition: border-color .2s;
    }
    .chat-form input:focus { border-color: var(--accent); }
    .chat-form input::placeholder { color: var(--muted); }
    #chat-user  { width: 110px; flex-shrink: 0; }
    #chat-text  { flex: 1; }

    /* ── Quick links row ── */
    .quick-row {
      max-width: 900px;
      margin: 0 auto;
      display: flex;
      flex-wrap: wrap;
      gap: 0.6rem;
    }

    .pill {
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: 50px;
      padding: 0.4rem 1rem;
      font-size: 0.85rem;
      font-weight: 400;
      color: var(--text);
      text-decoration: none;
      transition: border-color .2s, background .2s;
    }
    .pill:hover {
      border-color: var(--accent);
      background: var(--accent-lt);
    }

    /* ── Footer ── */
    footer {
      max-width: 900px;
      margin: 3rem auto 0;
      padding-top: 1.5rem;
      border-top: 1px solid var(--border);
      font-size: 0.8rem;
      color: var(--muted);
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 0.5rem;
    }

    /* Fade-in animation */
    @keyframes fadeUp {
      from { opacity: 0; transform: translateY(12px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    header, .search-wrap, .section-title, .grid, .quick-row, footer {
      animation: fadeUp .4s ease both;
    }
    .search-wrap  { animation-delay: .06s; }
    .section-title:nth-of-type(1) { animation-delay: .12s; }
    .grid         { animation-delay: .16s; }
    .section-title:nth-of-type(2) { animation-delay: .22s; }
    .quick-row    { animation-delay: .26s; }
    footer        { animation-delay: .32s; }
  